afmotor need help im useing this for 2 stepper motors only one works why ?

// k soo this is a revised code from the sample code ladyada had this to what i under stand should run my 2 stepper motors 5 steps each but im not vary good with makeing codes just started learning the basics… i have 2 stepper motors one on each side of the af motor shield and moor one is the drive and motor 2 is for steering and only the drive motoer will step and nothing happens on the m1 and m2 port side im not sure what i have to do to make it work i spent 2 hours tonight trying lil test and othere codes and reading about the shield and no one has mentiond if they have dne a simple setup like first stepper motor move 5 steps and then second line of code move second stepper 10 steps any one got some help for a poor guy tryig to play with his robot ?

#include <AFMotor.h>

AF_Stepper motor1(48, 2);
AF_Stepper motor2(48, 2);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println(“Stepper test!”);
motor2.setSpeed(30); // 10 rpm
motor1.setSpeed(30); // 10 rpm
motor2.step(1, FORWARD, SINGLE);


void loop() {

motor1.step(5, FORWARD, SINGLE);
motor2.step(5, FORWARD, SINGLE);


AF_Stepper motor1(48, 2);
AF_Stepper motor2(48, 2);

You can't have two stepper motors on the same port.

"Create the stepper motor object with AF_Stepper(steps, stepper#) to setup the motor H-bridge and latches. Steps indicates how many steps per revolution the motor has. A 7.5 degree/step motor has 360/7.5 = 48 steps. Stepper# is which port it is connected to. If you're using M1 and M2, its port 1. If you're using M3 and M4 its port 2"

ok so it should look like this above the setup line ?

AF_Stepper_motor (48, 1); // for motor # 1
AF_Stepper_motor (48, 2);// for motor # 2

wiith out the dash bettwen stepper and motor of course the fourm wont let me fix my typo

and then call the motor steps out like

motor1 and motor 2 for the int ? and how meany steps each i tryed the while sample it did not compile the code with the while state ment in there so ill try this and run one at a time .


wiith out the dash bettwen stepper and motor of course the fourm wont let me fix my typo

That is what the # icon is for. Select your code and hit the # icon, then the forum puts exactly what you type in a box.