Created
January 10, 2012 17:18
-
-
Save johnmckerrell/1590089 to your computer and use it in GitHub Desktop.
Stepper Motor Settings
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 stepsPerRevolution = 2048; // change this to fit the number of steps per revolution | |
// for your motor | |
// initialize the stepper library on pins 8 through 11: | |
Stepper myStepper(stepsPerRevolution, 7,5,6,4); | |
void setup() { | |
// set the speed at 60 rpm: | |
myStepper.setSpeed(5); | |
// initialize the serial port: | |
Serial.begin(9600); | |
} | |
void loop() { | |
// step one revolution in one direction: | |
Serial.println("clockwise"); | |
myStepper.step(stepsPerRevolution); | |
delay(500); | |
Serial.println("counterclockwise"); | |
myStepper.step(-stepsPerRevolution); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment