Datasheet
Next is the sensor logging code
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.0;
float temperatureC = (voltage - 0.5) * 100.0 ;
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
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);
}
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
© Adafruit Industries https://learn.adafruit.com/adafruit-data-logger-shield Page 82 of 85