blob: 180f5cd2f32419f4cc0a058a8cefd61c8353077f (
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
|
#include <Arduino.h> #include <Wire.h> #include "data.h" #include "battery.h" #include "display.h" #include "co2.h" #include "pm.h" Battery battery; PM pm; CO2 co2; SensorData data; Display display; void setup() { Serial.begin(115200); while (!Serial) { delay(100); }
Wire.begin(21,22); display.start(); display.show(&data); 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); delay(5000); }
|