Motor shield is not working as expected when connected to battery. When Arduino is connected to USB, motor is moving both FORWARD and BACKWARD, but when connected to battery, it moving only in FORWARD direction. I don't think so it's battery issue, because motor speed is good even it moves only in FORWARD direction.
Below is the code,
#include <AFMotor.h>
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
void setup() {
Serial.begin(9600);
Serial.println("Motor");
motor1.setSpeed(254);
motor2.setSpeed(254);
motor1.run(RELEASE);
motor2.run(RELEASE);
}
void loop() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
delay(500);
}
Requires a little power trigger or if we wait for around 2-3 minutes the motor works good. Motor shield drains the battery often. Seems to be it requires more power supply. Power supply from USB cable works perfectly rather than batteries