int timer = 1000; //creamos una variable con valro 1000
int LEDS[]={2,3,4,5,6,7};//creamos una variabel donde conectamos pin de los leds
void setup() {
Serial.begin(9600);//inicializamos el puerto serie
for (int thisPin = 0; thisPin < 6; thisPin++) {
pinMode(LEDS[thisPin], OUTPUT);
Serial.println(LEDS[thisPin]);
}
}
void loop() {
for (int thisPin = 0; thisPin < 6; thisPin++) {
digitalWrite(LEDS[thisPin], HIGH);//encendemos los leds progresivamente
delay(timer);//ponemosun retraso de 1000 milisegundos
digitalWrite(LEDS[thisPin], LOW);//apagamos los leds
}
delay(timer/2);//ponemos un delay de la mitad de la variabel timer, 1000/2=500 milisegundos
for (int thisPin = 6; thisPin >= 0; thisPin--) {
digitalWrite(LEDS[thisPin], HIGH);//encendemos los leds progresivamente
delay(timer);//ponemos un retraso de 1000 milisegundos
digitalWrite(LEDS[thisPin], LOW);//apgamos los leds progresivamente
}
delay(timer/2);//ponemos un retraso de la mitad de la variable timer, 1000/2=500 milisegundos
}