Knight Rider Car Strobe Effect

This project replicates the iconic LED scanning effect seen on KITT, the talking car from the classic Knight Rider TV series. A row of six LEDs lights up one by one from left to right, then in reverse from right to left, creating a smooth strobe or scanning motion. This creates a visually engaging effect that's great for cosplay props, custom car mods, or learning sequential logic using Arduino.
Supplies
- Arduino Uno (or compatible board)
- 6 LEDs
- 6 resistors (220–330Ω)
- Breadboard
- Jumper wires
- USB cable (to upload the code)
Build the Circuit

- Place the 6 LEDs on the breadboard in a row.
- Connect each long leg (anode) of the LEDs to digital pins 2 to 7 on the Arduino.
- Connect a 220Ω resistor to the short leg (cathode) of each LED.
- Connect the other end of each resistor to the GND rail on the breadboard.
- Connect the GND rail to one of the GND pins on the Arduino.
Arduino IDE
- Open the Arduino IDE on your computer.
- Go to Tools > Board and select Arduino Uno (or your specific board).
- Go to Tools > Port and select the COM port your Arduino is connected to.
Code Explanation
int timer = 100;
void setup() {
for (int pin = 2; pin < 8; pin++) {
pinMode(pin, OUTPUT);
}
}
void loop() {
for (int pin = 2; pin < 8; pin++) {
digitalWrite(pin, HIGH);
delay(timer);
digitalWrite(pin, LOW);
}
for (int pin = 7; pin >= 2; pin--) {
digitalWrite(pin, HIGH);
delay(timer);
digitalWrite(pin, LOW);
}
}
🔍 Code Explanation
int timer = 100;
- This line declares a variable named timer and sets it to 100 milliseconds.
- It controls the speed of the LED sweep—a delay between turning LEDs on and off.
- You can make the scanner move faster or slower by changing this number.
void setup()
- This function runs once when the Arduino is powered on or reset.
- It’s used to initialize settings like pin modes.
for (int pin = 2; pin < 8; pin++) {
pinMode(pin, OUTPUT);
}
- This for loop sets digital pins 2 through 7 as output pins using pinMode.
- Why 2 to 7? Because we want to control 6 LEDs on pins 2, 3, 4, 5, 6, and 7.
- The loop starts at pin = 2 and runs while pin < 8, increasing pin by 1 each time.
void loop()
- This function runs repeatedly in a loop, forever.
- It contains the two sequences that create the Knight Rider scanning effect.
🔹 Forward Sweep
for (int pin = 2; pin < 8; pin++) {
digitalWrite(pin, HIGH);
delay(timer);
digitalWrite(pin, LOW);
}
- This loop turns each LED on one by one from pin 2 to 7.
- digitalWrite(pin, HIGH) turns on the LED at the current pin.
- delay(timer) waits 100 milliseconds (or whatever value you set).
- digitalWrite(pin, LOW) turns the LED off before moving to the next one.
- This creates a left-to-right animation.
🔹 Reverse Sweep
for (int pin = 7; pin >= 2; pin--) {
digitalWrite(pin, HIGH);
delay(timer);
digitalWrite(pin, LOW);
}
- This loop does the same thing in reverse, from pin 7 down to 2.
- It lights each LED right-to-left, completing the "ping-pong" effect.
- The pin-- decreases the pin number each time the loop runs.
Upload Code
- Click the Upload (→) button.
- Wait for the code to compile and transfer to the Arduino
Downloads
Watch the LEDs Animate
Once the code runs:
- The LEDs light up one by one from left to right, then right to left, simulating a scanning or sweeping motion.
- This mimics the strobe effect from Knight Rider’s KITT car front panel.