Last active
March 23, 2017 21:45
-
-
Save jesu0404/1be145f460bdc1c7e4dbea9a6c0ab676 to your computer and use it in GitHub Desktop.
Tells stepper motor to turn two steps clockwise and one step counterclockwise continuously.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Stepper.h> | |
const int stepsPerRev = 200; | |
Stepper myStepper(stepsPerRev, 8, 9, 10, 11); | |
void setup() { | |
myStepper.setSpeed(60); | |
Serial.begin(9600); | |
} | |
void loop() { | |
Serial.println("clockwise"); | |
myStepper.step(stepsPerRev); | |
delay(500); | |
Serial.println("counterclockwise"); | |
myStepper.step(-stepsPerRev); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment