So I hook up my TMP36 sensor tonight and run the example code.
I am using the 5v and analog 0
703 - analog
3.43 - voltage output
293 - converted to degrees C
and
when I heat the sensor with my fingers, the temperature drops...
int temperaturePin = 0;
void setup()
{
Serial.begin(9600); //Start the serial connection with the copmuter
//to view the result open the serial monitor
//last button beneath the file bar (looks like a box with an antenae)
}
void loop() // run over and over again
{
Serial.println(analogRead(0));
float temperature = getVoltage(temperaturePin);
Serial.println(temperature); //getting the voltage reading from the temperature sensor
temperature = (temperature - 0.50) * 100.0; //converting from 10 mv per degree wit 500 mV offset //to degrees ((volatge - 500mV) times 100)
Serial.println(temperature); //printing the result
delay(1000); //waiting a second
}
/*
* getVoltage() - returns the voltage on the analog input defined by
* pin
*/
float getVoltage(int pin){
return (analogRead(pin) * .004882814); //converting from a 0 to 1024 digital range
// to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}