Knight Rider's Car light using Arduino

 

Knight Rider's Car light 


In this blog I am going to share my idea regarding the way to make a knight rider car light blink using an Arduino.


How it works?

In this project LED’s will blink like knight rider car’s light. First, it will blink from left to right and then, it blinks from right to left.


What do we need?

1         Arduino UNO    

2         Arduino IDE(software)

3         Red LED x 6

4       USB Cable Type A/B (2.0)

5       Resistor (220 Ω) x 6

6       Jumper wires(Male to Male)  x 7

7       Bread board


How to do?

1. Set up all the connections

First, use the Arduino UNO and draw a circuit virtually in tinker cad and setup all the connections. Then, code correctly and simulate it successfully.





First, set 6 LED's  in order. All negative sides of LED’s connected to one side and all positive sides of single LED connected through a single resistor. Then, it would result in the above manner. 

Next, connect all negative pins of LED’s to the ground (GND) pin on Arduino with a single jumper wire and all 6 positive pins to the digital pin 2 to 7, orderly.

3. Write the code.

Write  the code correctly for the LED’s to blink like knight rider’s car light. Steps are indicated below:

First, write the code to declare the output within the pinMode method in side the void setup method.


Next, connect all positive pins of LED’s to the pin 2 to 7 on Arduino board. So I declared ‘for loop’ and it will increase from pin 2 to pin 7. Then, all the LED’s in the pin from pin 2 to pin 7 will be set as output pins.

Within the void loop, write the code to blink the LED’s from left to right. Here, the ti
me variable is declared as 't'.





Next, write the code to blink the LED’s from right to left.








Finally, connect the Arduino board using USB Cable Type A/B (2.0) and upload the code.

Then, you could examine that the LED's work perfectly like the Knight Rider's car light.


          I      

Comments