Hey,
I keep getting an error with my temperature sensor. The sensor returns wrong values, temperatures above 100°C, and I have no idea why. Can you help me? My code:
int sensorPin = 0; //using analog pin 3
void setup()
{
Serial.begin(9600);
}
void loop()
{
//getting the voltage reading from the temperature sensor
int reading = analogRead(sensorPin);
// converting that reading to voltage
float voltage = reading * 3.3;
voltage /= 1024.0;
// print out the voltage
Serial.print(voltage); Serial.println(" volts");
// now print out the temperature
float temperatureC = (voltage - 0.5) * 100 ;
Serial.print(temperatureC); Serial.println(" degrees C");
delay(1000);
}
I'm looking forward for your replies,
PowerMG