int led_pins[] = {3,5,6,9};
int num_leds = sizeof(led_pins)/sizeof(int);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
for (int i=0;i<num_leds;i++){
pinMode(led_pins[i], OUTPUT);
digitalWrite(led_pins[i], LOW);
}
}
void loop() {
// put your main code here, to run repeatedly:
int timedelay = 5;
for (int j = 0;j<num_leds;j++){
for (int i=0;i<255;i++){
analogWrite(led_pins[j],i);
delay(timedelay);
}
}
for (int j = 0;j<num_leds;j++){
for (int i=255;i>=0;i--){
analogWrite(led_pins[j],i);
delay(timedelay);
}
}
delay(1000);
}