/* SparkFun Inventor’s Kit using the temperature sensor to measure the temperature in Centigrade the readings displayed on the serial monitor This code is completely free for any use. */ float voltage = 0; //the voltage measured from the TMP36 float degreesC = 0; //the temperature in Celsius, calcuated from the voltage void setup() { // initialize the serial port Serial.begin(9600); } void loop() { // integra value read from by the Arduino from the temp sensor int analogValue; analogValue = analogRead(A0); voltage = ((float) analogValue) * 5 / 1023; //convert the analog reading, which varies from 0 to 1023, back to a voltage value from 0-5 volts // the sensor outputs 0.01 volt for every degree Centigrade (Celsius) degreesC = voltage * 100.0; //convert the voltage to a temperature in degrees Celsius. Serial.print("sensor value: "); Serial.println(analogValue); Serial.print("Temp.: "); Serial.println(degreesC); delay(1000); //delay for 1 second between each reading (this makes the display less noisy) }