diagram is here
STEPS: 1. Take 10 resistors of 220 ohm each. 2. Take 10 LEDs of different colors. 3. Connect the cathode end of all LEDs to the GND pin of Arduino. 4. Connect the anode pin of all LEDs with each resistor connected to the end. 5. Now connect the resistors end to pin 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 of the Arduino. 6. Do connections same as circuit diagram. Your LED chaser is ready… You can make your own LED dancing circuit by just improving the code. Cheers! Also subscribe my Youtube channel “SOMA Electronics”
Thanks!
Aurduino Code
int pinsCount=10; // declaring the integer variable pinsCount
int pins[] = {2,3,4,5,6,7,8,9,10,11}; // declaring the array pins[]
void setup() {
for (int i=0; i<pinsCount; i=i+1){ // counting the variable i from 0 to 9
pinMode(pins[i], OUTPUT); // initialising the pin at index i of the array of pins as OUTPUT
}
}
void loop() {
for (int i=0; i<pinsCount; i=i+1){ // chasing right
digitalWrite(pins[i], HIGH); // switching the LED at index i on
delay(100); // stopping the program for 100 milliseconds
digitalWrite(pins[i], LOW); // switching the LED at index i off
}
for (int i=pinsCount-1; i>0; i=i-1){ // chasing left (except the outer leds)
digitalWrite(pins[i], HIGH); // switching the LED at index i on
delay(100); // stopping the program for 100 milliseconds
digitalWrite(pins[i], LOW); // switching the LED at index i off
}
}


