To begin, what do these two lines do:
Code: Select all
File logfile;
Code: Select all
DateTime now;
Also, if I wanted to create a new file every day, would this code do that if inserted in the main loop? (The code in the if statement came from the walkthrough)
Code: Select all
if(now.hour == 0 && now.minute == 0 && now.second > 0 && now.second <= 30 ){ // 30 second sampling rate
char filename[] = "LOGGER00.CSV";
for (uint8_t i = 0; i < 100; i++) {
filename[6] = i/10 + '0';
filename[7] = i%10 + '0';
if (! SD.exists(filename)) {
// only open a new file if it doesn't exist
logfile = SD.open(filename, FILE_WRITE);
break; // leave the loop!
}
}
}