Skip to content

Instantly share code, notes, and snippets.

@andysmithfal
Created May 2, 2014 00:02
Show Gist options
  • Save andysmithfal/37939fa6df8f03ead43f to your computer and use it in GitHub Desktop.
Save andysmithfal/37939fa6df8f03ead43f to your computer and use it in GitHub Desktop.
#include <Stepper.h>
const int stepsPerRevolution = 2050;
Stepper myStepper(stepsPerRevolution, 2, 3, 4, 5);
void setup() {
myStepper.setSpeed(5);
}
void loop() {
//do a full 360 and stop - using the stepsPerRevolution value set above
myStepper.step(stepsPerRevolution);
delay(1000);
//do 180 degrees
myStepper.step(stepsPerRevolution/2);
delay(1000);
//move an arbitrary amount of steps
myStepper.step(500);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment