Devices & Components
Arduino Nano
Through Hole Resistor, 33 kohm
Resistor 220 ohm
Resistor 475 ohm
Through Hole Resistor, 680 ohm
Through Hole Resistor, 20 kohm
Resistor 330 ohm
5 mm LED: Green
5 mm LED: Yellow
SparkFun Solder-able Breadboard
5 mm LED: Red
Resistor 100 ohm
General Purpose Transistor NPN
Hardware & Tools
Soldering iron (generic)
Drill / Driver, Cordless
Hot glue gun (generic)
Software & Tools
Arduino IDE
Project description
Code
Simple lightshow
c_cpp
1// LED PINS (n € N) 2// green: 2n+1, n<5 3// red: 2n+2, n<5 4// yellow: n+11, n<3 5 6#define SHORT unsigned short 7 8void setup() { 9 10 for(SHORT pin=1; pin<14; pin++) 11 pinMode(pin, OUTPUT); 12} 13 14void clearLeds() { 15 16 for(SHORT pin=1; pin<14; pin++) 17 digitalWrite(pin, LOW); 18} 19 20void firstProgramme() { 21 22 for(SHORT pin=1; pin<14; pin++) 23 digitalWrite(pin, HIGH); 24 25 delay(3000); 26 27 clearLeds(); 28} 29 30void secondProgramme() { 31 32 delay(700); 33 34 for(SHORT n=0; n<5; n++) { 35 36 digitalWrite(2*n+1, HIGH); 37 digitalWrite(2*n+2, HIGH); 38 39 delay(700); 40 } 41 42 for(SHORT pin=11; pin<14; pin++) 43 digitalWrite(pin, HIGH); 44 45 delay(700); 46 47 for(SHORT i=0; i<6; i++) 48 for(SHORT n=13; n>10; n--) { 49 50 for(SHORT pin=11; pin<14; pin++) 51 digitalWrite(pin, pin == n); 52 53 delay(100); 54 } 55 56 digitalWrite(11, LOW); 57 58 for(SHORT pin=13; pin>10; pin--) { 59 digitalWrite(pin, HIGH); 60 delay(100); 61 } 62 63 clearLeds(); 64} 65 66void thirdProgramme() { 67 68 SHORT counter = 0; 69 70 for(SHORT pin=11; pin<14; pin++) 71 digitalWrite(pin, HIGH); 72 73 while(counter<31) { 74 75 for(SHORT pin=1; pin<11; pin++) 76 digitalWrite(pin, (pin + counter)%2); 77 78 delay(300); 79 counter++; 80 } 81 82 clearLeds(); 83} 84 85void loop() { 86 87 firstProgramme(); 88 secondProgramme(); 89 thirdProgramme(); 90 91}
Simple lightshow
c_cpp
1// LED PINS (n € N) 2// green: 2n+1, n<5 3// red: 2n+2, n<5 4// yellow: n+11, n<3 5 6#define SHORT unsigned short 7 8void setup() { 9 10 for(SHORT pin=1; pin<14; pin++) 11 pinMode(pin, OUTPUT); 12} 13 14void clearLeds() { 15 16 for(SHORT pin=1; pin<14; pin++) 17 digitalWrite(pin, LOW); 18} 19 20void firstProgramme() { 21 22 for(SHORT pin=1; pin<14; pin++) 23 digitalWrite(pin, HIGH); 24 25 delay(3000); 26 27 clearLeds(); 28} 29 30void secondProgramme() { 31 32 delay(700); 33 34 for(SHORT n=0; n<5; n++) { 35 36 digitalWrite(2*n+1, HIGH); 37 digitalWrite(2*n+2, HIGH); 38 39 delay(700); 40 } 41 42 for(SHORT pin=11; pin<14; pin++) 43 digitalWrite(pin, HIGH); 44 45 delay(700); 46 47 for(SHORT i=0; i<6; i++) 48 for(SHORT n=13; n>10; n--) { 49 50 for(SHORT pin=11; pin<14; pin++) 51 digitalWrite(pin, pin == n); 52 53 delay(100); 54 } 55 56 digitalWrite(11, LOW); 57 58 for(SHORT pin=13; pin>10; pin--) { 59 digitalWrite(pin, HIGH); 60 delay(100); 61 } 62 63 clearLeds(); 64} 65 66void thirdProgramme() { 67 68 SHORT counter = 0; 69 70 for(SHORT pin=11; pin<14; pin++) 71 digitalWrite(pin, HIGH); 72 73 while(counter<31) { 74 75 for(SHORT pin=1; pin<11; pin++) 76 digitalWrite(pin, (pin + counter)%2); 77 78 delay(300); 79 counter++; 80 } 81 82 clearLeds(); 83} 84 85void loop() { 86 87 firstProgramme(); 88 secondProgramme(); 89 thirdProgramme(); 90 91}
Downloadable files
SIngle color series circuit
SIngle color series circuit

Simplified prefboard design
Simplified prefboard design

Simplified prefboard design
Simplified prefboard design

SIngle color series-parallel circuit
SIngle color series-parallel circuit

SIngle color series circuit
SIngle color series circuit

Comments
Only logged in users can leave comments