diff options
-rw-r--r-- | datalog.h | 10 | ||||
-rw-r--r-- | main.ino | 2 |
2 files changed, 8 insertions, 4 deletions
@@ -21,8 +21,11 @@ public: void start() { SDSPI.begin(SDCARD_SCLK, SDCARD_MISO, SDCARD_MOSI); - SD.begin(SDCARD_CS, SDSPI); + bool sdok=SD.begin(SDCARD_CS, SDSPI); + Serial.print("sdok: ");Serial.println(sdok); + Serial.println(SD.cardSize()); logfile = SD.open("air-quality.csv",FILE_APPEND,true); + Serial.print("file: ");Serial.println(logfile.path()); linesSinceLastFlush=0; } @@ -44,11 +47,14 @@ public: data->batteryVoltage ); - logfile.write((uint8_t *)line,65); + size_t written=logfile.write((uint8_t *)line,65); Serial.write(line); + Serial.print("written: ");Serial.println(written); if (++linesSinceLastFlush > flushThreshold) { logfile.flush(); linesSinceLastFlush=0; + + Serial.println("flushed"); } } }; @@ -29,8 +29,6 @@ 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(); |