Created
October 31, 2012 01:34
-
-
Save antitree/3984293 to your computer and use it in GitHub Desktop.
Stupid halloween pumpkins
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
/* | |
Stupid Pumpkins | |
v0.03 | |
*/ | |
unsigned char upDown=1; // start off going UP | |
int cylon=0; | |
int leds=11; // number of LEDs plugged in | |
int demo=1; | |
int count=0; | |
void setup() { | |
//just chill | |
//Serial.begin(9600); | |
} | |
void loop() { | |
//if (demo==1){ | |
if(upDown==1){ | |
cylon++; | |
if(cylon>=leds ) | |
if (demo==1) upDown=0; | |
else{ | |
cylon=0; // Reached max LED, next time we need to go down | |
count++; | |
} | |
} | |
else { | |
cylon--; | |
if(cylon==0) { | |
upDown=1; | |
count++; // Reached min LED, next time we need to go up | |
}} | |
pinMode(cylon, OUTPUT); | |
digitalWrite(cylon, HIGH); | |
//Serial.println(cylon); | |
//Serial.println(count); | |
delay(150); // wait for a second | |
digitalWrite(cylon, LOW); | |
if (count<4){ | |
demo=2; | |
} | |
else if (count < 8){ | |
demo=1; | |
} | |
else{ | |
count=0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment