Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

steppers running simultaneously
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

steppers running simultaneously

by 100mph on Mon Mar 31, 2008 11:12 am

I've got my steppers up and running but I can't get them to both run simultaneously. Is there code I can use to get this to happen or is the resulting "one motor fires then the other" pattern a result of the motor shield hardware circuit.

Thanks,
mg
100mph
 
Posts: 6
Joined: Sun Mar 30, 2008 12:46 pm

by adafruit on Mon Mar 31, 2008 12:02 pm

this is a 'software' problem not a hardware one. check out the library code, what you want is to call onestep() and interleave the call to stepper #1 and #2

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

interleave?

by 100mph on Mon Mar 31, 2008 5:01 pm

I'm a code newbie. Do you think you could explain "interleave". Where do I put the interleave call in this code below. Or do I have to go alter the AFMotor.h or the AFMotor.cpp

#include <AFMotor.h>



AF_Stepper motor_freight(200, 1);
AF_Stepper motor_passenger(200, 2);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");

motor_freight.setSpeed(80); // 60 rpm
motor_passenger.setSpeed(100);

}

void loop() {
motor_freight.step(300, FORWARD, SINGLE);
delay(500);
motor_passenger.step(500, FORWARD, SINGLE);
delay(10);
motor_freight.step(100, BACKWARD, SINGLE);
delay(500);
motor_passenger.step(200, FORWARD, SINGLE);
delay(500);


}
100mph
 
Posts: 6
Joined: Sun Mar 30, 2008 12:46 pm

by adafruit on Mon Mar 31, 2008 6:00 pm

you need to do something like

loop 300 times:
motor_freight.step(1, FORWARD, SINGLE);
motor_passenger.step(1, FORWARD, SINGLE);


that will step the two motors at the same time

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Please be positive and constructive with your questions and comments.