Adafruit schreibt: "The step() function is synchronous and does not return until all steps are complete."
Aber auch: "The oneStep() function is a low-level internal function called by step(). But it can be useful to call on its own to implement more advanced functions such as acceleration or coordinating simultaneous movement of multiple stepper motors."
Was macht dies:
#include <Wire.h>
#include <Adafruit_MotorShield.h>
int schritte;
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); //Erstelle Motorshield
Adafruit_StepperMotor *Motor1 = AFMS.getStepper(SPU, 1); //Erstelle Schrittmotor (Schritte pro Umdrehung, Anschluss 1 oder 2)
Adafruit_StepperMotor *Motor2 = AFMS.getStepper(SPU, 2);
void setup() {
Serial.begin(9600);
Serial.println("Stepper test!");
AFMS.begin(); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz
Motor1->setSpeed(100); // Motorgeschwindigkeit ... Umdrehungen pro Minute
Motor2->setSpeed(100);
}
void loop() {
if (schritte < 100) Motor1->onestep(FORWARD, DOUBLE);
if (schritte < 150) {
Motor2->onestep(FORWARD, DOUBLE);
schritte++;
}
delay(10);
}
Aber auch: "If you want to have more of a 'background task' stepper control, check out AccelStepper library (install similarly to how you did with Adafruit_MotorShield) which has some examples for controlling three steppers simultaneously with varying acceleration."
Hast Du schon mal AFMotor_MultiStepper.pde von AccelStepper probiert?