Introduction: Knight Rider Chasing Headlights

The red headlights on the Knight Rider car.

Supplies

Arduino

6 LED bord with built in 1k Risistors

Step 1:

Attach your led bord with the ground pin adjacent to pin 13

Step 2:

Download following code and enjoy:


const int outPin1 = 13; // Analog output pin that the LED is attached to

const int outPin2 = 12; // Analog output pin that the LED is attached to

const int outPin3 = 11; // Analog output pin that the LED is attached to

const int outPin4 = 10; // Analog output pin that the LED is attached to

const int outPin5 = 9; // Analog output pin that the LED is attached to

const int outPin6 = 8; // Analog output pin that the LED is attached to


void setup() {

  pinMode(outPin1, OUTPUT); // set pin 13 as an output

  pinMode(outPin2, OUTPUT); // set pin 13 as an output

  pinMode(outPin3, OUTPUT); // set pin 13 as an output

  pinMode(outPin4, OUTPUT); // set pin 13 as an output

  pinMode(outPin5, OUTPUT); // set pin 13 as an output

  pinMode(outPin6, OUTPUT); // set pin 13 as an output

}

void loop() {

 // put your main code here, to run repeatedly:

 digitalWrite(outPin1, HIGH);

 delay(100);

 digitalWrite(outPin1, LOW);

 digitalWrite(outPin2, HIGH);

 delay(100);

 digitalWrite(outPin2, LOW);

 digitalWrite(outPin3, HIGH);

 delay(100);

 digitalWrite(outPin3, LOW);

 digitalWrite(outPin4, HIGH);

 delay(100);

 digitalWrite(outPin4, LOW);

 digitalWrite(outPin5, HIGH);

 delay(100);

 digitalWrite(outPin5, LOW );

 digitalWrite(outPin6, HIGH);

 delay(100);

 digitalWrite(outPin5, HIGH);

 digitalWrite(outPin6, LOW);

 delay(100);

 digitalWrite(outPin4, HIGH);

 digitalWrite(outPin5, LOW);

 delay(100);

 digitalWrite(outPin3, HIGH);

 digitalWrite(outPin4, LOW);

 delay(100);

 digitalWrite(outPin2, HIGH);

 digitalWrite(outPin3, LOW);

 delay(100);

 digitalWrite(outPin1, HIGH);

 digitalWrite(outPin2, LOW);

 delay(100);

}