Arduino stops sending data to Serial after a long time period

I am using a Arduino UNO device as a permanently connected device that sometimes sends signals to PC (Windows 7 x64)

It workds perfectly but sometimes, after a long period of time PC stops receiving data from Arduino device. It is not a PC software issue, as all software acts same - can send data TO arduino(device responds to commands), can't receive it back.

Similar problem was http://arduino.cc/forum/index.php?topic=77828.0 , but no solution was suggested.

Disconnecting/connecting a device solved issue temporaly, but this can't be a solution, as device is supposed to be used permanently and fully automatically.

Possibly a memory issue on the Arduino - are you using Strings? Post your code for better help.

But it is still receiving & processing all commands OK

Source code is attached

ArduinoSunrise.ino (5.03 KB)

On a brief inspection, I don't see any obvious issues in your code, but there is a lot of String handling there, which is bad news if you want this system to run in perpetuity. Consider changing your code to use char arrays.

I agree that String should not be used. I'd also suggested examining your code, and qualifying constants with the "const" keyword.

If that are memory leaks problems, how would Arduino program a) successfully process INPUT serial commands, that are filled in buffer. If no memory available, that would not be working. b) wont recover after reseted. only disconnecting USB and reconnecting it again c) blinks with TX led when data should be being sent to PC