Created
June 27, 2009 05:04
-
-
Save koki-h/136904 to your computer and use it in GitHub Desktop.
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
//点滅速度を早くし、往復するようにした(ナイトライダー) | |
#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