Datasheet

Then the familiar RTC.now() call to get a snapshot of the time. Once we have that, we write
a timestamp (seconods since 2000) as well as the date in YY/MM/DD HH:MM:SS time
format which can easily be recognized by a spreadsheet. We have both because the nice
thing about a timestamp is that its going to montonically increase and the nice thing about
printed out date is its human readable
Log sensor data
Next is the sensor logging code
This code is pretty straight forward, the processing code is snagged from our earlier tutorial.
Then we just print() it to the card with a comma seperating the two
We finish up by turning the green LED off
int photocellReading = analogRead(photocellPin);
delay(10);
int tempReading = analogRead(tempPin);
// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = tempReading * 5.0 / 1024;
float temperatureC = (voltage - 0.5) * 100 ;
float temperatureF = (temperatureC * 9 / 5) + 32;
logfile.print(", ");
logfile.print(photocellReading);
logfile.print(", ");
logfile.println(temperatureF);
#if ECHO_TO_SERIAL
Serial.print(", ");
Serial.print(photocellReading);
Serial.print(", ");
Serial.println(temperatureF);
#endif //ECHO_TO_SERIAL
digitalWrite(greenLEDpin, LOW);
}
© Adafruit Industries https://learn.adafruit.com/adafruit-data-logger-shield Page 65 of 68