How to make knight rider chaser using Arduino UNO



What is knight rider chaser circuit?

 

LED knight rider circuits utilize on a car, bike, bicycle, truck, buses, and so on as they give eye-capturing impact to the viewers. In this circuit, we utilize a 555 IC as an astable multivibrator to deliver positive pulses. While two CD4017 Johnson decade counter is coordinated with 555 IC to enact LEDs one by one. but today I using Arduino UNO board. This is a very easy project. especially important for beginners.

 

Required material <click and buy>

·        Arduino UNO

·        Breadboard

·        LED

·        Jumper wire

 Circuit Diagram

 


STEP 01 (connect LED to a breadboard)



STEP 02 (connect LED to Arduino UNO using jumper wire)



STEP 03 (Program to Arduino UNO) <using for loop>

int pinsCount=10;                        // declaring the integer variable pinsCountint 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
  }
}

STEP 04 (Code compile and upload)



STEP 05 (It’s work)