Created
June 10, 2016 06:03
-
-
Save monpetit/0cbc515fbbf4b3094ce040de37105871 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 steps = 600; | |
| // initialize the stepper library on pins 8 through 11: | |
| Stepper motor(steps, 8, 9, 10, 11); | |
| void setup() | |
| { | |
| // set the speed at 60 rpm: | |
| motor.setSpeed(60); | |
| // initialize the serial port: | |
| Serial.begin(9600); | |
| } | |
| void loop() | |
| { | |
| // steps in one direction: | |
| Serial.println("clockwise"); | |
| motor.step(steps); | |
| delay(500); | |
| // steps in the other direction: | |
| Serial.println("counterclockwise"); | |
| motor.step(-steps); | |
| delay(500); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment