I'm developing an application with an Arduino Mega 2560 and all seams to work fine until I disconnect the USB cable.
The code loads fine, and the algorithm runs according the information coming from the sensor as expected. But immediately after I unplug the USB cable the algorithm stops working as before and the entire systems becomes rather unpredictable.
The application is a very simple robot with 2 DC motors, a servo and an Ir sensor. The power is supplied by a battery pack (9V in total)
Has anyone experienced this before? I'm using Arduino IDE 0021