I am working with a stepper motor hooked up to pins 9, 10, 11, and 12 on an Arduino Uno. In order to rotate the stepper motor, I wrote a helper method. This particular stepper motor rotates 1.8 degrees per step. The method is:
void rotateStepperBy(float deg) {
int steps = deg / 1.8;
motor.step(steps);
}
The method works fine for small degree measures, but behaves in unexpected ways (under rotating, rotating back and forth) if I give it larger degree measures like 45 and 90. Here's an example I was trying:
#include <Stepper.h>
Stepper motor(200, 9, 10, 11, 12);
void setup() {
rotateStepperBy(360);
}
void loop() {
rotateStepperBy(90);
delay(10);
}
void rotateStepperBy(float deg) {
int steps = deg / 1.8;
motor.step(steps);
}
Does motor.step complete and then the rest of the program resumes or does there need to be a longer delay for bigger degree measurements to allow the motor to finish stepping?