Created
March 10, 2014 18:13
-
-
Save LucyMatch/9470764 to your computer and use it in GitHub Desktop.
Arduino code for Sheep on the Beach. The project uses a stepper motor to rotate dancing figures. Video can be found here https://vimeo.com/88674460
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
/* | |
Stepper Motor Control - Constant Revolutions | |
This program drives a unipolar or bipolar stepper motor. | |
The motor is attached to digital pins 8 - 11 of the Arduino. | |
Created 03/09/14 | |
Joselyn McDonald | |
Denah Emerson | |
Lucy Matchett | |
Alex Totsi | |
*/ | |
#include <Stepper.h> | |
const int stepsPerRevolution = 10; // 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, 8,9,10,11); | |
void setup() { | |
// set the speed at 400 rpm: | |
myStepper.setSpeed(400); | |
// initialize the serial port: | |
Serial.begin(9600); | |
} | |
void loop() { | |
// step through revolutions in one direction: | |
Serial.println("clockwise"); | |
myStepper.step(stepsPerRevolution); | |
Serial.println(stepsPerRevolution); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment