Skip to content

Instantly share code, notes, and snippets.

@bensonk
Created October 8, 2011 07:37
Show Gist options
  • Save bensonk/1271987 to your computer and use it in GitHub Desktop.
Save bensonk/1271987 to your computer and use it in GitHub Desktop.
#define cycleTime 150
void setup() {
for(int i = 2; i < 13; i++)
pinMode(i, OUTPUT);
}
void usePin(int pin) {
for(int i = 2; i < 13; i++)
digitalWrite(i, LOW);
digitalWrite(pin, HIGH);
}
int p = 0;
int direction = 1;
void loop() {
if(p >= 11) direction = -1;
if(p <= 2) direction = 1;
usePin(p);
p += direction;
delay(cycleTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment