void setup() {
// use a for loop to initialize each pin as an output:
for (int thisPin = 8; thisPin <= 13; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 8; thisPin <= 13; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(100);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
// loop from the highest pin to the lowest:
for (int thisPin = 13; thisPin >= 8; thisPin--) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(100);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
}