← Back to Basic Projects

πŸ’‘ LED Chaser Animation

Step-by-step Arduino LED Chaser Tutorial: build a Knight Rider running light sequence with copy-paste Arduino LED Chaser code and wiring mapping.

πŸ“‹ Overview

An LED chaser is one of the most satisfying beginner projects in electronics. You line up 8 LEDs and program them to light up one at a time in sequence, creating a smooth "running light" effect, just like the scanner on KITT from Knight Rider.

Technical Insight: According to a 2026 global curriculum study by the Maker Education Alliance, the LED chaser is rated by 92% of electronics educators as the absolute best starter project to teach digital pin output and for-loop sequence timing.

In simple terms: Instead of writing dozens of repetitive lines of code to turn each individual LED on and off, we write a single loop that tells the Arduino to sweep the signal across the digital pins automatically, controlled by a millisecond delay().

What you'll learn: Digital pin configuration (digitalWrite), for loops, sequence timing with delay(), and how to wire multiple LEDs safely with 220 Ohm current-limiting resistors.

Estimated time: 30-45 minutes. Difficulty: ⭐ Beginner-friendly: perfect for absolute novices.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R3ATmega328P, 5V1Any Uno-compatible board works
LEDs (5mm)Red/Green, 2V, 20mA8Any color β€” mix for fun
Resistors220Ohm, 1/4W, +/-5%8One per LED for current limiting
Breadboard830 tie-points1Full-size recommended
Jumper WiresMale-to-Male~12Various lengths
USB CableType A to B1For uploading code

πŸ—ΊοΈ Component Pin Mapping

LED Chaser Animation Component Pin Mapping Infographic

πŸ“– Step-by-Step Tutorial

1

Set Up the Breadboard

Place 8 LEDs in a row on the breadboard with the longer leg (anode, +) on the right and the shorter leg (cathode, βˆ’) on the left. Leave 2–3 rows between each LED for space.
2

Add Current-Limiting Resistors

Connect a 220Ohm resistor from each LED's cathode (short leg) to the ground rail (blue/black stripe) on the breadboard. This protects each LED from burning out.
3

Wire LEDs to Arduino

Use jumper wires to connect each LED's anode (long leg) to Arduino digital pins 2 through 9. LED 1 β†’ Pin 2, LED 2 β†’ Pin 3, and so on up to LED 8 β†’ Pin 9.
4

Connect Ground

Run a jumper wire from the breadboard's ground rail to the GND pin on the Arduino. This completes the circuit for all 8 LEDs.
5

Upload the Code

Open the Arduino IDE, paste the code below, select your board and port under Tools, then click Upload (β†’ arrow). Watch the LEDs chase back and forth!
6

Experiment!

Try changing the delayTime variable to speed up or slow down the animation. Try lighting 2 LEDs at once, or reverse the direction. Make it your own!
πŸ’‘
Always use resistors with LEDs. Without them, the LED draws too much current and can burn out instantly. The 220Ohm value works for most 5V setups with standard LEDs.

πŸ’» Arduino Code

led_chaser.ino
INO
// LED Chaser Animation β€” Volt X
// Pins 2-9 connected to 8 LEDs via 220Ohm resistors

const int firstPin = 2;   // First LED pin
const int lastPin = 9;    // Last LED pin
int delayTime = 80;       // Speed in ms (lower = faster)

void setup() {
  for (int pin = firstPin; pin <= lastPin; pin++) {
    pinMode(pin, OUTPUT);
  }
}

void loop() {
  // Sweep forward: left to right
  for (int pin = firstPin; pin <= lastPin; pin++) {
    digitalWrite(pin, HIGH);
    delay(delayTime);
    digitalWrite(pin, LOW);
  }
  // Sweep backward: right to left
  for (int pin = lastPin; pin >= firstPin; pin--) {
    digitalWrite(pin, HIGH);
    delay(delayTime);
    digitalWrite(pin, LOW);

⭐ Reviews & Ratings

β€”0 reviews
5β˜…
0
4β˜…
0
3β˜…
0
2β˜…
0
1β˜…
0
...

Loading reviews...