I want to drive to DC motors.
I have an Arduino UNO and an arduino motor shield rev3.
Arduino motor shield current measurment jumpers are cut off (I need the Analog Input for other sensors)
The power jumper is also cut off.
I use 4 AA batteries (6V) for the motors and a 9V battery to power the Arduino.
Motor A works fine for both directions
Motor B works only when I set the B DIR PIN (13) to HIGH. (one direction) but not in the other.
I made a setup using only Arduino UNO, Arduino Motorshield, the two motors and power supply.
//MOTOR A PINS (LEFTMOTOR)
#define MOTOR_A_DIR_PIN 12
#define MOTOR_A_PWM_PIN 3
#define MOTOR_A_BRAKE_PIN 9
//#define MOTOR_A_CS_PIN A0
//MOTOR B PINS (RIGHT MOTOR)
#define MOTOR_B_DIR_PIN 13
#define MOTOR_B_PWM_PIN 11
#define MOTOR_B_BRAKE_PIN 8
//#define MOTOR_B_CS_PIN A1
void setup() {
pinMode(MOTOR_A_DIR_PIN, OUTPUT);
pinMode(MOTOR_A_PWM_PIN, OUTPUT);
pinMode(MOTOR_A_BRAKE_PIN, OUTPUT);
pinMode(MOTOR_B_DIR_PIN, OUTPUT);
pinMode(MOTOR_B_PWM_PIN, OUTPUT);
pinMode(MOTOR_B_BRAKE_PIN, OUTPUT);
// Release the breaks... Just to be sure
digitalWrite(MOTOR_A_BRAKE_PIN,LOW);
digitalWrite(MOTOR_B_BRAKE_PIN,LOW);
//Set direction for both motors
digitalWrite(MOTOR_A_DIR_PIN, LOW);
digitalWrite(MOTOR_B_DIR_PIN, LOW);
//Send speed to both motors
analogWrite(MOTOR_A_PWM_PIN, 250);
analogWrite(MOTOR_B_PWM_PIN, 250);
//Wait for a while
delay(1000);
// Stop the motors
analogWrite(MOTOR_A_PWM_PIN, 0);
analogWrite(MOTOR_B_PWM_PIN, 0);
}
void loop() {
// put your main code here, to run repeatedly:
}
Am I missing something on the code?
I am afraid that it might be a hardware issue. Is it possible I damaged something on the shield when cutting the power and current measurement jumpers.
If so any ideas what should I try to check on the shield?