Created
July 29, 2013 03:06
-
-
Save boxalljohn/6101929 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
/* | |
exercise 1.1 - using the 'for' command in exercise 0.1 | |
Created 02/04/2010 --- CC by-sa v3.0 Share the love! - By John Boxall --- http://tronixstuff.com | |
Based on an orginal by H. Barragan for the Wiring i/o board | |
*/ | |
int del=100; // sets a default delay time, 1000 milliseconds (one second) | |
void setup() | |
{ | |
// initialize the digital pins as outputs: | |
for (int i = 2; i<=9 ; i++) | |
{ | |
pinMode(i, OUTPUT); | |
} // end of for loop | |
} // end of setup | |
void loop() | |
{ | |
for (int i = 2; i<=9; i++) // blink from LEDs 2 to 9 | |
{ | |
digitalWrite(i, HIGH); | |
delay(del); | |
digitalWrite(i, LOW); | |
} | |
for (int i = 8; i>=3; i--) // blink from LEDs 8 to 3 | |
{ | |
digitalWrite(i, HIGH); | |
delay(del); | |
digitalWrite(i, LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment