Let's Make Robots!

Adafruit motor shield, just running one motor

I have looked at the tutorials from adafruit, such as this one:  http://www.ladyada.net/make/mshield/use.html and I can include the library in my program, I tried the examples and I get nothing. I am using 7.2 volts for my power supply and the motor is from an rc car. I have tested the motors with a different h-bridge that came with my DFrobotshop rover and it works fine. The code is pretty straight forward, I just don't know what I am doing wrong. Any help would be greatly appreciated. 


I finally charged my battery and plugged it into the power connection on the motor shield. I think I found out why it was working. My Capacitor exploded!!! So I must of put in the wrong way....there goes 20 bucks. Do you think I will be able to fix it if I replace the capacitor.




#include <AFMotor.h>

AF_DCMotor motor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");
  motor.setSpeed(200);     // set the speed to 200/255

void loop() {
  motor.run(FORWARD);      // turn it on going forward

  motor.run(BACKWARD);     // the other way
  motor.run(RELEASE);      // stopped


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I have one of these too.... its brill and takes a lot of hammering to break (ie i have cooked the LDs many a time and it always jumped back)

Check five things :-

  1. Power jumper JP1 connector. (this one always catches me out)
  2. You have the latest library (the old library had two of the motors swapped - whoops - M3 and M4)
  3. Check motor positions 1,3,4 to see if they are also the same. (to illiminate dead drivers)
  4. Sometimes a high dutycycle sent to the motors cause them to just Buzz or Sing (less torque), maybe reduce to lower duty cycle .
  5. Older boards have incorrect silk screen markings.....

NB :- the L293D are rated at 600ma and peak 1.2A - check what the stall current of your motor is. I once successfully paralleled M1 and M2 together for one motor and M3 and M4 for second motor to double the Current drive.

The last advise i can give is to remove the L293D chips and wire them up on a bread board - its really a dead easy thing to do and then you can see if its the board or L293Ds that are playing up.

Is the AFMotor.h in the correct directory?


After some more reading, I have a couple more questions. The other h-bridge you used, was it comparable to the one/s found on the adafruit motor shield, namely in current handling capability? And, did you connect the motor to the correct pair of screw terminals?

My directory is Documents/Arduino/libraries/MotorShield/AFMotor.cpp for your other questions, both h-bridges use the L293D. I don not know about current hadling capability. Both wires are in the correct screw terminals, I doubled checked.