// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// this version uses delay() to manage timing
byte directionPin = 8;
byte stepPin = 9;
int numberOfSteps = 200;
int pulseWidthMicros = 50; // microseconds
int millisbetweenSteps = 30; // milliseconds - or try 1000 for slower steps
void setup() {
Serial.println("Starting StepperTest");
pinMode(directionPin, OUTPUT);
pinMode(stepPin, OUTPUT);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
digitalWrite(stepPin, LOW);
delay(60);
}
digitalWrite(directionPin, HIGH);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
digitalWrite(stepPin, LOW);
delay(10);
}
}
void loop() {
}