Datasheet

The first important thing is the delay() call, this is what makes the Arduino wait around until
its time to take another reading. If you recall we #defined the delay between readings to
be 1000 millseconds (1 second). By having more delay between readings we can use less
power and not fill the card as fast. Its basically a tradeoff how often you want to read data
but for basic long term logging, taking data every second or so will result in plenty of data!
Then we turn the green LED on, this is useful to tell us that yes we're reading/writing data
now.
Next we call millis() to get the 'time since arduino turned on' and log that to the card. It can
be handy to have - especially if you end up not using the RTC.
Serial.print(", ");
#endif
// fetch the time
now = RTC.now();
// log time
logfile.print(now.get()); // seconds since 2000
logfile.print(", ");
logfile.print(now.year(), DEC);
logfile.print("/");
logfile.print(now.month(), DEC);
logfile.print("/");
logfile.print(now.day(), DEC);
logfile.print(" ");
logfile.print(now.hour(), DEC);
logfile.print(":");
logfile.print(now.minute(), DEC);
logfile.print(":");
logfile.print(now.second(), DEC);
#if ECHO_TO_SERIAL
Serial.print(now.get()); // seconds since 2000
Serial.print(", ");
Serial.print(now.year(), DEC);
Serial.print("/");
Serial.print(now.month(), DEC);
Serial.print("/");
Serial.print(now.day(), DEC);
Serial.print(" ");
Serial.print(now.hour(), DEC);
Serial.print(":");
Serial.print(now.minute(), DEC);
Serial.print(":");
Serial.print(now.second(), DEC);
#endif //ECHO_TO_SERIAL
© Adafruit Industries https://learn.adafruit.com/adafruit-data-logger-shield Page 64 of 68