int led_pin[] = {2,3,4,5,6};
int num_led = sizeof(led_pin)/sizeof(int);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
for (int i=0;i<num_led;i++){
pinMode(led_pin[i], OUTPUT);
digitalWrite(led_pin[i], LOW);
}
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0;i<num_led;i++){
digitalWrite(led_pin[i], HIGH);
delay(500);
}
for (int n = num_led-1;n>=0;n--){
digitalWrite(led_pin[n], LOW);
delay(500);
}
delay(500);
}