Devices & Components
Arduino Mega 2560 Rev3
Breadboard (generic)
Resistor 221 ohm
LED (generic)
Software & Tools
Arduino IDE
Project description
Code
Sequential LEDS
arduino
just open on your IDE Arduino
1/* SEQUENTIAL LEDS 2 * by Jomar B Amaral 3 * jomar.amaral@gmail.com for more information 4 * with small modifications on this code many different sequences are possible 5 */ 6 7int ledPin[] = {38, 40, 42, 44, 46, 48, 50, 52}; //pins used, you can modify to you arduino board 8int i = 38; //you can modify to you arduino board, i is the first pin your led is connected 9int x = 52; //you can modify to you arduino board, x is the last pin your led is connected 10 11void setup() 12{ 13 for (int j=0; j<9; j++) 14 { 15 pinMode(ledPin[j], OUTPUT); // configura pino digital como sada 16 } 17} 18 19void loop() 20{ 21 for (i; i <= 52; i++) 22 { 23 digitalWrite(i,HIGH); 24 delay(100); // optional delay, in this case leds turn on one by one by 100 ms 25 } 26 { 27 for (x; x >= 38; x--) 28 { 29 digitalWrite(x,LOW); 30 delay(100); //leds turn off one by one by 100 ms 31 } 32 { 33 x=52; //optional 34 i=38; //optional 35 } 36 } 37} 38
Sequential LEDS
arduino
just open on your IDE Arduino
1/* SEQUENTIAL LEDS 2 * by Jomar B Amaral 3 * jomar.amaral@gmail.com 4 for more information 5 * with small modifications on this code many different 6 sequences are possible 7 */ 8 9int ledPin[] = {38, 40, 42, 44, 46, 48, 50, 10 52}; //pins used, you can modify to you arduino board 11int i = 38; //you can modify 12 to you arduino board, i is the first pin your led is connected 13int x = 52; //you 14 can modify to you arduino board, x is the last pin your led is connected 15 16void 17 setup() 18{ 19 for (int j=0; j<9; j++) 20 { 21 pinMode(ledPin[j], OUTPUT); 22 // configura pino digital como sada 23 } 24} 25 26void loop() 27{ 28 for 29 (i; i <= 52; i++) 30 { 31 digitalWrite(i,HIGH); 32 delay(100); // optional 33 delay, in this case leds turn on one by one by 100 ms 34 } 35 { 36 for 37 (x; x >= 38; x--) 38 { 39 digitalWrite(x,LOW); 40 delay(100); //leds 41 turn off one by one by 100 ms 42 } 43 { 44 x=52; //optional 45 i=38; 46 //optional 47 } 48 } 49} 50
Downloadable files
Protoboard schematic
In this image we have how to link the wires, resistors, LEDS to the arduino board.
Protoboard schematic
Protoboard schematic
In this image we have how to link the wires, resistors, LEDS to the arduino board.
Protoboard schematic
Esquema
Esquema

Comments
Only logged in users can leave comments