
Driving Multiple LEDs — SIK Circuit 4
Imiyalelo
Parts & Introduction
Parts & Introduction
This experiment uses 8 LEDs to create light patterns. You'll learn about arrays (grouping related variables) and for loops (repeating actions efficiently). The sketch includes 6 different animation functions you can try.
Parts Needed
- 1x Arduino Uno + USB cable
- 1x Breadboard
- 8x LEDs (any color)
- 8x 330Ω Resistors
- 9x Jumper Wires
Materials for this step:
SparkFun Inventors Kit - V3.21 ikhithi
330 Ohm Resistor8 izicucu
Jumper Wires9 izicucuTools needed:
Hardware Hookup
Hardware Hookup
Wiring Instructions
- Place 8 LEDs in a row on the breadboard.
- For each LED, connect the negative leg (shorter) through a 330Ω resistor to GND.
- Connect the positive leg (longer) of each LED to Arduino digital pins 2 through 9 (LED 1 = pin 2, LED 2 = pin 3, etc.).
- Connect the GND rail on the breadboard to Arduino GND.
Tip: Keep the LEDs neatly spaced for the best visual effect.
Materials for this step:
330 Ohm Resistor8 izicucu
Jumper Wires9 izicucuArduino Code
Arduino Code
Open the Arduino IDE and upload the following sketch to your Arduino board.
Materials for this step:
Tools needed:
Test & Experiment
Test & Experiment
What You Should See
All 8 LEDs light up one after another, then turn off in reverse order. This repeats continuously.
Troubleshooting
- Some LEDs don't light: Easy to insert an LED backwards. Check polarity.
- Out of sequence: With 8 wires, it's easy to cross a couple. Verify LED 1 is on pin 2, then each pin in order.
- Starting fresh: Sometimes pulling everything out and re-wiring is faster than debugging.
Experiments to Try
- Uncomment the other functions in
loop()to try:oneOnAtATime(),pingPong(),marquee(),randomLED(). - Create your own animation pattern!
- Modify the delay times to change the speed.
Izinto
6- 1 ikhithi$105.00
- 8 izicucu$3.00
- $5.00
CC0 Isizinda Somphakathi
Le blueprint ikhishwe ngaphansi kwe-CC0. Ukhululekile ukukopisha, ukuguqula, ukusabalalisa, nokusebenzisa ngaphandle kwemvume.
Sekela uMenzi ngokuthenga imikhiqizo nge-Blueprint yabo IKhomishane Yomenzi kumiswe ngabathengisi, noma dala inguqulo entsha yale Blueprint bese uyifaka njengoxhumaniso ku-Blueprint yakho ukuze wabelane ngemali engenayo.