/* SEQUENTIAL LEDS
* by Jomar B Amaral
* jomar.amaral@gmail.com for more information
* with small modifications on this code many different sequences are possible
*/
int ledPin[] = {38, 40, 42, 44, 46, 48, 50, 52}; //pins used, you can modify to you arduino board
int i = 38; //you can modify to you arduino board, i is the first pin your led is connected
int x = 52; //you can modify to you arduino board, x is the last pin your led is connected
void setup()
{
for (int j=0; j<9; j++)
{
pinMode(ledPin[j], OUTPUT); // configura pino digital como sada
}
}
void loop()
{
for (i; i <= 52; i++)
{
digitalWrite(i,HIGH);
delay(100); // optional delay, in this case leds turn on one by one by 100 ms
}
{
for (x; x >= 38; x--)
{
digitalWrite(x,LOW);
delay(100); //leds turn off one by one by 100 ms
}
{
x=52; //optional
i=38; //optional
}
}
}
Comments