Created
November 11, 2012 16:41
-
-
Save skelter/4055460 to your computer and use it in GitHub Desktop.
Blink lights in sequences that we can count
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
void setup() { | |
// initialize the digital pin as an output. | |
// Pin 13 has an LED connected on most Arduino boards: | |
pinMode(13, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
for(int i =0; i < 10; i++) { | |
Serial.print(i); | |
Serial.print(" "); | |
for (int j = 0; j < i; j++) { | |
int idelay = 200; | |
digitalWrite(13, HIGH); // set the LED on | |
delay(idelay); // wait for a second | |
digitalWrite(13, LOW); // set the LED off | |
delay(idelay); // wait for a second | |
Serial.print("."); | |
} | |
Serial.println(); | |
delay(2000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment