Knight Rider LED
The Knight Rider is a basic Arduino project. What is Knight Rider LED Project? This project is just like our previous LED Chaser project in that project the LEDs were Frequently ON and OFF to show the Chaser effect but in this one the LEDs will be Frequently ON and OFF in such a way that it looks like a single LED is moving one end to another end and this phenomenon is called as LED Knight Rider.
Hey Guys...
This is our 2nd basic Arduino Project with LEDs, today we will make a Knight Rider. In this Project, I will be using 10 LEDs but in your, you can increase or Decrease the number of LEDs as per our demand.
Component Used:-
3. 10 LEDs
4. Jumper Wires
Software Used:-
Note:- Here I am using 220 ohms Resister you can also use 200 ohms it will work as well, and you should have use the resisters when connecting LEDs with Arduino, because without Resisters your LEDs and Arduino might be Damaged so keep it in your mind.
Steps:-
Step 1:- Take LEDs and plugged all LEDs into the Breadboard in Series.
Step 2:- Now connect all short legs (-ve) in the Negative Bar of Breadboard, and connect it with GND pin of Arduino.
Step 3:- Then connect all the positive legs of the LEDs with Arduino as per the pin Nos that mentioned in the Program with the help of Jumper wires.
Step 4:- Now in the Arduino IDE:- connect the Arduino Board with the PC using a USB cable and check for the Board (Tools > Boards > Arduino Uno). Also, check for the COM port (Tools > Serial port > COM).
Step 5:- And upload the Program. whenever you are uploading the Program just unplug the Negative jumper from the Arduino.
Your Knight Rider is ready, you can adjust the speed of the Rider by just changing the delay_time vale at the beginning of the Program.
Enjoy.......
Schematics.
code.
Code Description:-
Here the first step is to Define the integer or int in this code we will define or declare ledPins 1 to 10 to Arduino pins 4 to 13.
void set
In the void set, we declare the pinMode like which pin acts as an INPUT and which is act as an OUTPUT here we can write pinMode(ledPin, OUTPUT); because we need this pin as an OUTPUT to show the output.
void loop
The void loop is used to run the program in a loop or it repeats itself mood. Here we write digitalWrite(ledPin,HIGH); to give the digital input as HIGH (i.e.,1) to turn ON the LED
and write digitalWrite(ledPin, LOW); to give digital input as LOW (i.e.,0) to turn OFF the LED. The
delay is used to give pause in between LED ON and OFF in this code we use delay timeof 50 milli sec.
No comments:
Post a Comment