Hallo zusammen
Kann mir evtl. jemand weiterhelfen, wie kann ich zwei Motoren mit dem untenstehenden Code,
synchron laufen lassen?
Gruss
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);
// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor1 = AFMS.getStepper(200, 1);
Adafruit_StepperMotor *myMotor2 = AFMS.getStepper(200, 2);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
AFMS.begin(); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz
myMotor1->setSpeed(1000); // 10 rpm
myMotor2->setSpeed(1000); // 10 rpm
}
void loop() {
myMotor1->step(1000, BACKWARD, SINGLE);
myMotor2->step(1000, FORWARD, SINGLE);