-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
55 lines (45 loc) · 1.61 KB
/
main.cpp
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "HumidityController.h"
#include "TemperatureController.h"
#include <DallasTemperature.h>
#include <OneWire.h>
#include <ClosedCube_HDC1080.h>
#include "Parameters.h"
#include <CommunicationControl.h>
OneWire ourWire(parameters::pSENSOR);
DallasTemperature sensors(&ourWire);
TemperatureController temperatureController;
ClosedCube_HDC1080 hdc1080;
CommunicationControl communicationControl;
HumidityController humidityController;
void setup() {
Serial.print("hello");
communicationControl.begin();
Serial.begin(9600);
sensors.begin();
pinMode(parameters::pSENSOR, INPUT);
pinMode(parameters::pCONTROLE, OUTPUT);
pinMode(parameters::ld,OUTPUT);
temperatureController.begin(&sensors);
hdc1080.begin(0x40); //Inicia o sensor de umidade
//humidityController.startManualMode(99);
humidityController.startAutomaticMode(90.0);
}
void loop() {
Serial.print("HR: ");
Serial.println(humidityController.getRelativeHumidity());
Serial.print("Humidifier PID: ");
Serial.println(humidityController.getPID());
Serial.print("Potenciometer: ");
Serial.println(humidityController.getpotIntensity());
Serial.print("Dryer Temperature: ");
Serial.println(temperatureController.getTemperature());
Serial.print("Hello1");
humidityController.run(); // Runs the PID responsable for the humidifier
Serial.print("Hello2");
float temp = hdc1080.readTemperature();
float h = hdc1080.readHumidity();
temperatureController.run(); //Runs the PID responsable for the dryer
communicationControl.run(); //Runs the communication between dryer and computer interface
Serial.print("Hello3");
delay(300);
}