Analogpins don't need a pinMode to be set,
There is a math error in voltage = reading * (3300 / 1024); 3300/1024 = allways 3
so this line just states voltage = reading * 3;
to make it float voltage = reading * 3300.0 / 1024; // note the .0 to force float!
==> code below
The actual temp should be 24 degrees Celsius.
So 25 degrees is an acceptable measurement, but 15 is not. As the math does not fluctuate It could be a loose contact; Or maybe you need to do an averaging of the temperature. I added a RAW reading print in the code below.
Can you post e.g. 20-50 readings?
int tempSenPin = 0;
void setup()
{
Serial.begin(9600);
Serial.prinln("start"); // for debugging only to see it works.
}
void loop()
{
int reading = analogRead(tempSenPin);
Serial.print("RAW: "); Serial.println(reading);
float voltage = reading * 3300.0 / 1024;
float tempC = (voltage - 500)/10;
Serial.print(tempC); Serial.println(" degrees C");
delay(1000);
}
There is also some code on -
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1262208606 - it uses different math.