blob: e51c3eac76290ac1e5347a90a82bf7f4509ac6a4 (
plain)
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 <Arduino.h> #include <Wire.h> #include "data.h" #include "battery.h" #include "display.h" #include "datalog.h" #include "co2.h" #include "pm.h" Battery battery; PM pm; CO2 co2; SensorData data; Display display; DataLog datalog; void setup() { Serial.begin(115200); while (!Serial) { delay(100); }
Wire.begin(21,22); display.start(); display.show(&data); datalog.start(); battery.start(); co2.start(); pm.start(); Serial.println("Waiting for first measurement... (5 sec)"); delay(5000); } void loop() { bool changed; if (battery.dataReady()) { changed=true; battery.read(&data); } if (pm.dataReady()) { changed = true; pm.read(&data); } if (co2.dataReady()) { changed = true; co2.read(&data); } if (changed) { display.show(&data); datalog.show(&data); } delay(5000); }
|