Skip to content

Instantly share code, notes, and snippets.

@koki-h
Created June 27, 2009 05:04
Show Gist options
  • Save koki-h/136904 to your computer and use it in GitHub Desktop.
Save koki-h/136904 to your computer and use it in GitHub Desktop.
//点滅速度を早くし、往復するようにした(ナイトライダー)
#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(100); // waits for a second
digitalWrite(i, LOW); // sets the LED off
}
for (int i = LED_PIN_MAX; i >= LED_PIN_MIN; i--){
digitalWrite(i, HIGH); // sets the LED on
delay(100); // 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