I am a beginner and face a problem with my motor shield v2 and the wired stepper motors. When I tried running different sketches where the motor is moved but never runs smooth.
I used the StepperTest sketch from examples. Can someone please tell me what I am doing wrong because I have no clue.
https://youtu.be/36QIgg-d-28
motor:
https://www.amazon.de/gp/product/B01LES ... UTF8&psc=1
Code: Select all
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);
void setup() {
Serial.begin(9600);
Serial.println("Stepper test!");
AFMS.begin();
myMotor->setSpeed(20);
}
void loop() {
Serial.println("Single coil steps");
myMotor->step(100, FORWARD, SINGLE);
myMotor->step(100, BACKWARD, SINGLE);
delay(1000);
Serial.println("Double coil steps");
myMotor->step(100, FORWARD, DOUBLE);
myMotor->step(100, BACKWARD, DOUBLE);
delay(1000);
Serial.println("Interleave coil steps");
myMotor->step(100, FORWARD, INTERLEAVE);
myMotor->step(100, BACKWARD, INTERLEAVE);
delay(1000);
Serial.println("Microstep steps");
myMotor->step(50, FORWARD, MICROSTEP);
myMotor->step(50, BACKWARD, MICROSTEP);
}
Regards Yannic