Thermostat code

You are reading a pot that reads from 0V to 5V. The Arduino's A2D reads the voltage in 1024 steps, thus each step represents 5/1024 ~= 5mV
This maps to 0 = 0oC and 1023 = 30oC.

The LM35 reads 10mV for each degree C, thus 250mV corresponds 25oC. This means the highest reading should be no more than 300mV.
300mV will be a reading of about 60.

I would read in the raw A2D reading and then use the map() function to compare apples to apples.

So something like this:

  fine = analogRead(5); //read the raw temp data
  fine = map(fine, 0, 1023, 0, 30); // adjust the raw reading to a scale from 0 to 30

then later

int temp;

temp = analogRead(0); //read the actual raw temp.  should be 0 to 60 for the 0 to 30[sup]o[/sup]C range
temp /= 2;                 // adjust a2d to our range

I think that works. Let me know if I'm crazy.