Adafruit motor shield v1.0 problems

I am having trouble with my adafruit motor shield v 1.0. I am trying to run the code for testing the motors in Michael Margolis’ books “Build an Arduino powered robot”. I have the connections to the motors soldered, the power led on the adafruit board turns on, and so does the arduino Leonardo. I am building the 4wd robot. I know the motors operate because I have taken the power from the 5 AA battery pack straight to each of the batteries and they all run.

Question 1: the m1-m4 connections. When looking at m1 (with the letter and number sideways on the left) which is the power to the motor, and which is ground? Same with m2, m3, m4.

Question 2: What are ways to troubleshoot the adafruit board?

Here is the code I am using. It compiles without problem:

[code]/*******************************************

  • MotorTest4wd.ino

  • Initial motor test for 4WD

  • robot rotates clockwise

  • (Left motors driven forward, right backward)

  • Michael Margolis 24 July 2012
    ********************************************/
    const int LED_PIN = 13;
    const int speed = 60; // percent of maximum speed

#include <AFMotor.h> // adafruit motor shield library (modified my mm)
AF_DCMotor Motor_Left_Front(4, MOTOR34_1KHZ); // Motor 4
AF_DCMotor Motor_Right_Front(3, MOTOR34_1KHZ); // Motor 3
AF_DCMotor Motor_Left_Rear(1, MOTOR12_1KHZ); // Motor 1
AF_DCMotor Motor_Right_Rear(2, MOTOR12_1KHZ); // Motor 2

int pwm;

void setup()
{
pinMode(A
Serial.begin(9600);
blinkNumber(8); // open port while flashing. Needed for Leonardo only

// scale percent into pwm range (0-255)
pwm= map(speed, 0,100, 0,255);
Motor_Left_Front.setSpeed(pwm);
Motor_Right_Front.setSpeed(pwm);
Motor_Left_Rear.setSpeed(pwm);
Motor_Right_Rear.setSpeed(pwm);
}

// run over and over
void loop()
{
Serial.println(“rotate cw”);
Motor_Left_Front.run(FORWARD);
Motor_Left_Rear.run(FORWARD);

Motor_Right_Front.run(BACKWARD);
Motor_Right_Rear.run(BACKWARD);

delay(5000); // run for 5 seconds
Serial.println(“stopped”);
Motor_Left_Front.run(RELEASE); // stop the motors
Motor_Right_Front.run(RELEASE);
Motor_Left_Rear.run(RELEASE); // stop the motors
Motor_Right_Rear.run(RELEASE);

delay(5000); // stop for 5 seconds
}

// function to indicate numbers by flashing the built-in LED
void blinkNumber( byte number) {
pinMode(LED_PIN, OUTPUT); // enable the LED pin for output
while(number–) {
digitalWrite(LED_PIN, HIGH); delay(100);
digitalWrite(LED_PIN, LOW); delay(400);
}
}[/code]

Hello.

We do not carry the Adafruit motor shield, so we are not familiar with using it. The Adafruit forum would be a more appropriate place to ask your questions concerning their products.

By the way, if you are using bi-directional DC motors, the wires can be plugged into either terminal for each port (M1-M4). It might be helpful for you to read the user’s manual for the Adafruit motor shield, which provides an good guide for using DC motors with the shield.

- Amanda