Skip to content

Instantly share code, notes, and snippets.

@boxalljohn
Created July 29, 2013 03:06
Show Gist options
  • Save boxalljohn/6101929 to your computer and use it in GitHub Desktop.
Save boxalljohn/6101929 to your computer and use it in GitHub Desktop.
/*
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