-
Notifications
You must be signed in to change notification settings - Fork 1
/
Arduheat.ino
51 lines (41 loc) · 928 Bytes
/
Arduheat.ino
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
#include <Arduino.h>
#include <PID_v1.h>
#include <TimeLib.h>
#include "cHeating.h"
#include "config.h"
#include "cTrigger.h"
cTrigger trigger(10000);
cHeating Heating;
cConfig Config(&Serial,&Heating);
time_t requestTimeSync() {
Serial.println("{\"Time\":[]}");
return 0;
}
/**
* @fn void setup(void)
* @brief Initializes the serial connection and defines the in- and outputs.
*/
void setup() {
// Initialize the Bridge, Console and FileSystem
Serial.begin(57600); // Set the baud.
while (!Serial) {
} // Wait until Serial1 is ready
Serial.println("Arduino Startup.");
// TimeLib time
setSyncProvider(requestTimeSync);
// analogReference(DEFAULT);
analogReference(EXTERNAL);
analogRead(0);
Config.resetConf();
}
/**
* @fn void loop(void)
* @brief Runs the main program which controls the system.
*/
void loop() {
Heating.Control();
Config.updateConf();
if (trigger.get()) {
Config.sendLog();
}
}