Skip to content

Instantly share code, notes, and snippets.

@antitree
Created October 31, 2012 01:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antitree/3984293 to your computer and use it in GitHub Desktop.
Save antitree/3984293 to your computer and use it in GitHub Desktop.
Stupid halloween pumpkins
/*
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