Hi All,
I'm having some issues with my motor shield and constant power to my motors.
I'm using a sainsmart 4WD arduino chassis with 4 x 4.5v motors
I have the motors wired to M1 - M4 of the adafruit motor shield with the power jumper removed and a 1800mAH 9.6v battery pack wired in.
When I run the motors using the code below they only seem to run for 4-5 seconds at most before stopping for a second and restarting. Can anyone suggest a cause or a method for troubleshooting? I'm pretty new to all of this.
#include <AFMotor.h>
int running=0;
NewPing sonar(trigPin, echoPin, MAX_DISTANCE);
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);
void setup() // run once, when the sketch starts
{
Serial3.begin(115200);
motor1.setSpeed(100);
motor2.setSpeed(100);
motor3.setSpeed(100);
//motor4.setSpeed(100);
startMotors();
}
void stopMotors()
{
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
running = 0;
}
void startMotors()
{
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
//motor4.run(BACKWARD);
running = 1;
}
void loop() {
}
Incidentally, today I noticed one of the power pins had broken on the front left motor so I had to use a soldering iron to melt the plastic and get at the contact again (nasty job). I believe the issue existed before I noticed this and the motor still isn't working. Related?