Hello,
I have a Arduino Uno R3 and this motor shield http://arduino.cc/it/Main/ArduinoMotorShieldR3 and this is the motor I try to power up http://www.robotshop.com/ca/tamiya-twin-motor-gearbox.html.
I want to power my shield with external power, so I cut the Vin connect and now the motor turn. But it is very weak and reverse did not work (not enough power I suppose) in A.
In B forward and backward work correctly.
Here is my voltage
A
2.62
-2.76 (motor not turning)
B
2.79
-2.61 (less voltage and the motor turn ??)
Directly in the battery
3.05
-.3.03
The motor is way faster when I connect it directly on the battery (2xAA) why ?
Thank you !
p.s. The code i have uploaded in my arduino
int dirB = 13; // Direction pin for motor B is Digital 12
int speedB = 11; // Speed pin for motor B is Digital 9 (PWM)
int brakeB = 8;
int dirA = 12; //Diretion pin for motor A is Digital 13
int speedA = 3; //Speed pin or motor A is Digital 10 (PWM)
int brakeA = 9;
void setup() {
//Setup Channel A
pinMode(dirA, OUTPUT); //Initiates Motor Channel A pin
pinMode(brakeA, OUTPUT); //Initiates Brake Channel A pin
pinMode(speedA, OUTPUT);
pinMode(dirB, OUTPUT); //Initiates Motor Channel A pin
pinMode(brakeB, OUTPUT); //Initiates Brake Channel A pin
pinMode(speedB, OUTPUT);
}
void loop()
{
forward();
delay(4000);
//brake();
backward();
delay(4000);
}
void forward()
{
digitalWrite(dirA, HIGH); //Establishes forward direction of Channel A
digitalWrite(brakeA, LOW); //Disengage the Brake for Channel A
analogWrite(speedA, 255); //Spins the motor on Channel A at full speed
digitalWrite(dirB, HIGH); //Establishes forward direction of Channel B
digitalWrite(brakeB, LOW); //Disengage the Brake for Channel B
analogWrite(speedB, 255); //Spins the motor on Channel B at full speed
}
void backward()
{
digitalWrite(dirA, LOW); //Establishes forward direction of Channel A
digitalWrite(brakeA, LOW); //Disengage the Brake for Channel A
analogWrite(speedA, 255); //Spins the motor on Channel A at full speed
digitalWrite(dirB, LOW); //Establishes forward direction of Channel B
digitalWrite(brakeB, LOW); //Disengage the Brake for Channel B
analogWrite(speedB, 255); //Spins the motor on Channel B at full speed
}