Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Arduino stepper motor control code
- #include <Stepper.h> // Include the header file
- // change this to the number of steps on your motor
- const int STEPS = 600;
- // create an instance of the stepper class using the steps and pins
- Stepper stepper(STEPS, 8, 10, 9, 11);
- void setup() {
- stepper.setSpeed(60);
- Serial.begin(9600);
- }
- void loop() {
- Serial.println("clockwise");
- stepper.step(STEPS);
- delay(500);
- Serial.println("counterclockwise");
- stepper.step(-STEPS);
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement