Heya all,
Ive got an Arduion Uno and I've hooked up a LM35CZ +5, GRD, and Analog1.
Below is the code I'm using to produce a Celsius printout to the serial monitor
int sensorPin = A1;
void setup()
{
Serial.begin(9600);
}
void loop()
{
int reading = analogRead(sensorPin);
float voltage = (reading * 5) / 1024.0; //voltage calculation
float temperatureC = (voltage-0.5) * 100 ; // temp calculation (-500mV for offset)
Serial.print(voltage); Serial.println(" Volts ");
Serial.print(temperatureC); Serial.println(" degress C");
Serial.println();
delay(1000);
}
This is the serial output
3.07 Volts
256.64 degrees C
3.07 Volts
256.64 degrees C
3.07 Volts
256.64 degrees C
Also if i put my finger on the sensor to warm it the voltage drops and the temp decreases and the opposite for cold
???
Im rather new to the Arduion and am probably missing something simple, but any guidance would be appreciated