Created
February 7, 2013 13:09
-
-
Save sbchisholm/4730797 to your computer and use it in GitHub Desktop.
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
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