Skip to content

Instantly share code, notes, and snippets.

@LucyMatch
Created March 10, 2014 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucyMatch/9470764 to your computer and use it in GitHub Desktop.
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
/*
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