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
steppers running simultaneously
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 6
- Joined: Sun Mar 30, 2008 12:46 pm
interleave?
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);
}
#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);
}
Please be positive and constructive with your questions and comments.