Created
March 18, 2012 11:24
-
-
Save arduinoboard/2070681 to your computer and use it in GitHub Desktop.
The file that is currently on an Arduino Uno with a serial number of 64932343838351C042E1
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
/* | |
Rotating Plant Stand | |
Rotates one revolution every two days, moving a small amount every half an hour | |
Based on example byTom Igoe | |
*/ | |
#include <Stepper.h> | |
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution | |
Stepper myStepper(stepsPerRevolution, 8,9,10,11); | |
long stepCount = 0; // number of steps the motor has taken | |
unsigned long interval = (1800000); // half an hour | |
long previousMillis = 0; | |
void setup() { | |
for (int i=0; i <=11; i++) | |
{ | |
myStepper.step(1); | |
stepCount=stepCount+1; | |
delay(10); | |
} | |
} | |
void loop() { | |
unsigned long currentMillis = millis(); | |
if(currentMillis - previousMillis > interval) | |
{ | |
previousMillis = currentMillis; | |
for (int i=0; i <=11; i++) | |
{ | |
myStepper.step(1); | |
stepCount=stepCount+1; | |
delay(10); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment