Thermostat with arduino Mega and http shield only working when on USB

Hello,

I try to make a thermostat for our sauna. Im using a lm35c with a arduino mega and a http shield so i can read the temp from a distance. There is also a lcd display and 2 buttons to set the temp.
Everything is working great but when i disconect the usb cable to the pc the program is starting behaving stranges.
It didnt stop warming after the set temp is crossed. When i put the usb back in the pc everything is working again.
I use a power supply from 5V to feed the arduino mega via the powerjack.
Is this a power issue? Please help.
Thanks in advance.

Filip

For the software look at the attachement.

thermostat.txt (6.69 KB)

The power jack requires at least 7V (and less than 12V). If you have a regulated 5V supply you can use the +5V and Ground pins for voltage input.