Skip to content

Instantly share code, notes, and snippets.

@skelter
Created November 11, 2012 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skelter/4055460 to your computer and use it in GitHub Desktop.
Save skelter/4055460 to your computer and use it in GitHub Desktop.
Blink lights in sequences that we can count
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