Skip to content

Instantly share code, notes, and snippets.

@SweiLz
Created January 11, 2020 10:37
Show Gist options
  • Save SweiLz/e7957cdfe6369b020321ca8ba586cf69 to your computer and use it in GitHub Desktop.
Save SweiLz/e7957cdfe6369b020321ca8ba586cf69 to your computer and use it in GitHub Desktop.
#include <Stepper.h>
const int stepsPerRevolution = 2048;
Stepper myStep = Stepper(stepsPerRevolution,8,10,9,11);
void setup() {
myStep.setSpeed(15); // speed in rpm
Serial.begin(9600);
}
void loop() {
Serial.println("clockwise");
myStep.step(stepsPerRevolution);
delay(500);
Serial.println("counterclockwise");
myStep.step(-stepsPerRevolution);
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment