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++ ) {
// set the direction of the i-th LED pin
pinMode( led_pin[i], OUTPUT );
// turn on the first LED (i=0) and the rest off.
digitalWrite( led_pin[i], (i==0) ? HIGH : 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);
digitalWrite(led_pin[i], LOW);
}
}