int timer = 1000;
int LEDS[]={2,3,4,5,6,7};
void setup() {
Serial.begin(9600);
//enciende los led en orden ascendente
for (int thisPin = 0; thisPin < 6; thisPin++)
//si thisPin es igual a 0 y es menor a 6 entonces aumentara
{
pinMode(LEDS[thisPin], OUTPUT);
//pone todos los pines como salida
Serial.println(LEDS[thisPin]);
//imprime el valor del pin
}
}
void loop() {
for (int thisPin = 0; thisPin < 6; thisPin++)
//si el thisPin es igual a 0 y menor a 6, entonces aumentara
{
digitalWrite(LEDS[thisPin], HIGH);
//se encendera el led en orden
delay(timer);//tiempo
digitalWrite(LEDS[thisPin], LOW);
//se apagara en orden los led
}
delay(timer/2);
//decrece cuadno llegue a 6
for (int thisPin = 6; thisPin >= 0; thisPin--)//bucle si el thisPin es igual a 6
//y thisPin es mayor o igual a cero, entonces disminuira
{
digitalWrite(LEDS[thisPin], HIGH);
delay(timer);
digitalWrite(LEDS[thisPin], LOW);
}
delay(timer/2);
}