Sometimes, when we turn on our micro controller (PIC V. 5) the power light flashes green/red and all the motors that are connected move for a short period of time, over and over again. What causes this? and how can it be avoided?
Any time the power light turns red it means the battery power is low or you have a loose battery connection.
Test your battery voltage
Wiggle the battery connector and see if you can make the light go red.
As rfolea said, your batter is probably loose, and when your battery reconnects, it causes a power surge, which causes your motors to spaz.