blob: 8dcb38796f8083b217f3346ac15d4134923c64d1 (
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
|
#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() { if (battery.dataReady()) battery.read(&data); if (pm.dataReady()) pm.read(&data); if (co2.dataReady()) co2.read(&data); display.show(&data); delay(5000); }
|