LED Chaser using Arduino
Hi guys hope you all doing good. In this article we are going to see about LEDs. Wait Wait Wait Not the boring LEDs but here we wanna make the knight riders with some LEDs and the Arduino.
THINGS WE NEED:
For this project we need some LEDs, an Arduino UNO or Arduino Mega whatever you have, the breadboard and lots of jumper wires.
BUILDING OR CONSTRUCTING:
First of all connect the LEDs into the breadboard, facing the negative leg of the led to the anyone of the power supply column of the breadboard and the positive leg of the LEDs to the center portion of the breadboard, here I am using 14 LEDs as the Arduino UNO board has 14 Digital I/O pins (0 to 13).
After connecting all the LEDs to the power supply column of the breadboard take some jumper wires and connect each of the jumper wires one end to the positive leg of the LEDs.(Note : Here I am using blue color LEDs so I didn't used a resistor and the Arduino Digital I/O pins are enough to power one led at the time but if you are using Red color or some other color please use a current limiting resistor to avoid blowing up LEDs).
Connect the jumper wires other end to the Arduino Digital pins from 0 to 13 respectively. Please don't mismatch or shuffle the wires while connecting to the Arduino board. After connecting all the positive wires, take one jumper wire and connect it to the GND terminal of the Arduino and connect the other end to the breadboard negative terminal.
Hardware part is over now the software part. Connect the Arduino board to your computer or PC.
PROGRAM CODE
Here is the simple code for the led chaser or knight rider LEDs
void setup() {
for (int i=0;i<=13;i++){
pinMode(i,OUTPUT);
}
// put your setup code here, to run once:
}
void loop() {
int u=100,v;
for(int j=0; j<=13;j++){
digitalWrite(j,HIGH);
delay(u);
digitalWrite(j,LOW);
}
delay(u);
for(int i=13; i>=0;i--){
digitalWrite(i,HIGH);
delay(u);
digitalWrite(i,LOW);
}
Upload the code to your Arduino and have some fun.
Here is the video of the output result........
Have fun :)
Hope you guys learnt something New !!!!!
See you again in the Next Articles Bye.....!!!!!!!!
0 Comments