mega help!

Hello I'm new to this forum .. I'm actually using an arduino mega 2650 and have been trying to make a thermo meter using the lm35 temperature sensor ( holding the sensor such that I can read the label The left leg was connected to 5v pin ' the middle was connected to analogue pin0 and the right was the ground) I used the same code I was using on arduino uno ... But the reading on the mega was 499.0 degrees 450.0 degrees 208.0 degrees and so ...any suggestions ?!

.any suggestions ?!

Post the program and a circuit diagram for a start

the diagram and the code are in the attachments .

Please read this before posting a programming question and post the code using code tags to make it possible to copy/paste it to an editor.

You mention the LM35, but you post code and a picture of the TMP36. ? Leo..

For LM35

The LM35 only produces voltages from 0 to +1V. The ADC uses 5V as the highest possible value. This is wasting 80% of the possible range. If you change aRef to 1.1V, you will get almost the highest resolution possible.

// To change aRef to 1.1V, you use the command "analogReference(INTERNAL);"
// INTERNAL1V1: a built-in 1.1V reference (Arduino Mega only)

// Here's an example sketch using 1.1 as aRef:

float tempC;
int reading;
int tempPin = 0;

void setup()

void loop()
reading = analogRead(tempPin);
tempC = reading / 9.31;

I know what I mentioned was different. The reason is that I wasn't at home and I needed help permanently. Thanks for help guys and I really appreciate your replies.