Last active
August 29, 2015 13:56
-
-
Save jkeefe/9179834 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
/* Arduino Example 01 - Blinking LED | |
* Modified for an 8-LED hoodie | |
* | |
* More info at http://johnkeefe.net/making-a-heartbeat-hoodie | |
* (This is Part I, without the heartbeat detector) | |
* | |
* John Keefe | |
* john@johnkeefe.net | |
*/ | |
// LEDs use pins A3 A4 A5 5 6 9 10 A2 | |
// set up an array for all of the LED pins | |
int light[] = {A3, A4, A5, 5, 6, 9, 10, A2}; | |
// this code runs once | |
void setup() { | |
for (int x = 0; x < 9; x++) { | |
pinMode(light[x], OUTPUT); // Set each pin as output | |
} | |
} | |
// this loop repeats forever | |
void loop() { | |
// turn each LED on in sequence | |
// from bottom to top | |
for (int y = 0; y < 8; y++) { | |
digitalWrite(light[y], HIGH); // turns LED on | |
delay(100); // waits for 1/10 second | |
} | |
// turn each LED off in reverse order | |
for (int z = 0; z < 8; z++) { | |
digitalWrite(light[7-z], LOW); // turns LED on | |
delay(100); // waits for 1 second | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment