int ledPins[] = {5,6,7,8,9,10,11,12,13}; void setup() { int index; for(index = 0; index <= 9; index++) { pinMode(ledPins[index],OUTPUT); } } void loop() { pingPong(); } void pingPong() { int index; int delayTime = 100; for(index = 0; index <= 9; index++) { digitalWrite(ledPins[index], HIGH); delay(delayTime); digitalWrite(ledPins[index], LOW); } for(index = 9; index >= 0; index--) { digitalWrite(ledPins[index], HIGH); delay(delayTime); digitalWrite(ledPins[index], LOW); } }