From dbdb59f0d069049a95efeb01e287dd51aca4f123 Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 1 Apr 2022 10:59:46 +0100 Subject: start of data logging to sd card --- main.ino | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'main.ino') diff --git a/main.ino b/main.ino index 180f5cd..9fcabbe 100644 --- a/main.ino +++ b/main.ino @@ -4,6 +4,7 @@ #include "data.h" #include "battery.h" #include "display.h" +#include "datalog.h" #include "co2.h" #include "pm.h" @@ -14,6 +15,7 @@ CO2 co2; SensorData data; Display display; +DataLog datalog; void setup() { Serial.begin(115200); @@ -27,6 +29,10 @@ void setup() { display.start(); display.show(&data); + // I think this has to come after the display.start(), they may both + // use the same SPI thing + datalog.start(); + battery.start(); co2.start(); pm.start(); @@ -42,7 +48,10 @@ void loop() { if (pm.dataReady()) { changed = true; pm.read(&data); } if (co2.dataReady()) { changed = true; co2.read(&data); } - if (changed) display.show(&data); - + if (changed) { + display.show(&data); + datalog.show(&data); + } + delay(5000); } -- cgit v1.2.3