Much more simple than what I had for a single direction program, and what you have is much easier for a newbie to understand.
I made these changes and was able to add the opposite direction rotation right after
#include <Stepper.h>
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
int stepCount = 0;
void setup() {
Serial.begin(9600);
myStepper.setSpeed(15); // RPM
Serial.println("starting");
myStepper.step(400);
Serial.println("finished");
Serial.begin(9600);
myStepper.setSpeed(15); // RPM
Serial.println("starting");
myStepper.step(-400);
Serial.println("finished");
}
void loop ()
{
}
A co-worker of mine always says less is better, this proves it...
I think I had many unneeded lines and commands that weighed it down and confused it?
Thanks! ![]()