int timer = 100;
int pins[7] = {D3, D2, D4, D5, D6, D0 };
void setup() {
for (int thisPin = 0; thisPin < 6; thisPin++) {
pinMode(pins[thisPin], OUTPUT); }
}
void loop() {
for (int thisPin = 0; thisPin < 6; thisPin++) {
digitalWrite(pins[thisPin], HIGH);
delay(timer);
digitalWrite(pins[thisPin], LOW); }
for (int thisPin = 6 - 1; thisPin >= 0; thisPin--) {
digitalWrite(pins[thisPin], HIGH);
delay(timer);
digitalWrite(pins[thisPin], LOW); }
}
沒有留言:
張貼留言