Skip to content

Instantly share code, notes, and snippets.

@koki-h
Created June 27, 2009 05:00
Show Gist options
  • Save koki-h/136903 to your computer and use it in GitHub Desktop.
Save koki-h/136903 to your computer and use it in GitHub Desktop.
//9個のLEDを1個づつ光らせていく
//http://www.youtube.com/watch?v=7TdfvWGedBA
#define LED_PIN_MIN 2
#define LED_PIN_MAX 10
void setup() // run once, when the sketch starts
{
for (int i = LED_PIN_MIN; i <= LED_PIN_MAX; i++){
pinMode(i, OUTPUT); // sets the digital pin as output
}
}
void loop() // run over and over again
{
for (int i = LED_PIN_MIN; i <= LED_PIN_MAX; i++){
digitalWrite(i, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(i, LOW); // sets the LED off
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment