Created
March 29, 2011 11:30
-
-
Save takkanm/892195 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 BASE_PIN 7 // 7番ピンに1番目のLEDが接続されている | |
| #define PIN_NUM 7 // 7つのLED | |
| #define DELAY_TIME 50 // 遅延させる時間(50 msec) | |
| void setup() { | |
| int i; | |
| // LEDの接続されているピンをデジタル出力として設定 | |
| for (i = 0; i < PIN_NUM; i++) { | |
| pinMode (BASE_PIN + i, OUTPUT); | |
| } | |
| } | |
| void loop() { | |
| int i; | |
| for (i = 0; i < PIN_NUM; i++) { | |
| digitalWrite(BASE_PIN + i, HIGH); // 指定したピンの電圧を上げる | |
| delay(DELAY_TIME); | |
| digitalWrite(BASE_PIN + i, LOW); // 指定したピンの電圧を下げる | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment