With serial, my program works the way I want it; without serial, it doesn't

Grumpy_Mike:

the both code WORK "correctly" as long as my microcontroller's connected through the serial port.

So it sounds like the problem is with your power supply. What is it and how is it connected?

The microcontroller is powered from a regulated 5 V (5.10 V to be exact) from the Roboclaw motor controller. And the Roboclaw motor controller's power from a 12V 14 A-hr lead acid battery.