- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHumidityController.cpp
More file actions
Latest commit
25 lines (20 loc) · 605 Bytes
/
Copy pathHumidityController.cpp
File metadata and controls
25 lines (20 loc) · 605 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
HumidityController.cpp
*/
#include"Arduino.h"
#include"HumidityController.h"
HumidityController::HumidityController(int sensorPin, int motorEnablePin, int motorIn1Pin, int motorIn2Pin)
{
pinMode(motorEnablePin, OUTPUT);
pinMode(motorIn1Pin, OUTPUT);
pinMode(motorIn2Pin, OUTPUT);
_sensorPin = sensorPin;
_motorEnablePin = motorEnablePin;
_motorIn1Pin = motorIn1Pin;
_motorIn2Pin = motorIn2Pin;
}
voidHumidityController::setMotor(int speed, bool reverse) {
digitalWrite(_motorEnablePin, speed);
digitalWrite(_motorIn1Pin, reverse);
digitalWrite(_motorIn2Pin, ! reverse);
}