Devices & Components
Arduino Uno Rev3
Resistor 10k ohm
5 mm LED: Red
Hardware & Tools
Premium Male/Male Jumper Wires, 40 x 3" (75mm)
Breadboard, 170 Pin
Software & Tools
Arduino IDE
Project description
Code
Untitled file
arduino
1int ledCount = 5; 2int leds[] = {13, 12, 11, 10, 9}; 3int currentState[] = {HIGH, LOW, LOW, LOW, LOW}; 4int currentHighLed = 0; 5 6void setup() { 7for (int i = 0; i < ledCount; i++) { 8pinMode(leds[i], OUTPUT); 9} 10} 11 12void loop() { 13 14for (int i = 0; i < ledCount; i++) { 15digitalWrite(leds[i], currentState[i]); 16} 17currentState[currentHighLed] = LOW; 18currentHighLed++; 19if (currentHighLed >= 5) { 20currentHighLed = 0; 21} 22currentState[currentHighLed] = HIGH; 23delay(500); 24}
Untitled file
arduino
1int ledCount = 5; 2int leds[] = {13, 12, 11, 10, 9}; 3int currentState[] = {HIGH, LOW, LOW, LOW, LOW}; 4int currentHighLed = 0; 5 6void setup() { 7for (int i = 0; i < ledCount; i++) { 8pinMode(leds[i], OUTPUT); 9} 10} 11 12void loop() { 13 14for (int i = 0; i < ledCount; i++) { 15digitalWrite(leds[i], currentState[i]); 16} 17currentState[currentHighLed] = LOW; 18currentHighLed++; 19if (currentHighLed >= 5) { 20currentHighLed = 0; 21} 22currentState[currentHighLed] = HIGH; 23delay(500); 24}
Downloadable files
As I am not good at these the correct led amount is 5 from pin 9-13
As I am not good at these the correct led amount is 5 from pin 9-13

Comments
Only logged in users can leave comments