Skip to content

Instantly share code, notes, and snippets.

@sbchisholm
Created February 7, 2013 13:09
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 sbchisholm/4730797 to your computer and use it in GitHub Desktop.
Save sbchisholm/4730797 to your computer and use it in GitHub Desktop.
int ledPins[] = {2,3,4,5,6,7,8,9};
int ledCount = 8;
void setup() {
for (int i = 0; i < ledCount; i++)
pinMode(ledPins[i], OUTPUT);
}
void loop() {
oneAfterAnotherNoLoop();
}
void oneAfterAnotherNoLoop() {
int delayTime = 100;
// turn on each LED
for (int i = 0; i < ledCount; i++) {
digitalWrite(ledPins[i], HIGH);
delay(delayTime);
}
// tuen off each LED
for (int i = ledCount-1; i >=0; i--) {
digitalWrite(ledPins[i], LOW);
delay(delayTime);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment