Skip to content

Instantly share code, notes, and snippets.

@takkanm
Created March 29, 2011 11:30
Show Gist options
  • Select an option

  • Save takkanm/892195 to your computer and use it in GitHub Desktop.

Select an option

Save takkanm/892195 to your computer and use it in GitHub Desktop.
#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