In this post, we are going to make knight rider circuit using led bargraph. Led graph, it consists of 10 leds.
Stuff required:
Source code:
Upload the code below to your arduino board
/* Code starts from here */
const int led[]={4,5,6,7,8,9,10,11,12,13},d=5;
void setup() {
for(int i=0;i<10;i++)
pinMode(led[i],OUTPUT);
}
void loop() {
for(int i=0;i<10;i++)
{
digitalWrite(led[i],HIGH);
delay(d);
digitalWrite(led[i],LOW);
}
for(int j=0;j<8;j++)
{
digitalWrite(led[8-j],HIGH);
delay(d);
digitalWrite(led[8-j],LOW);
}
}
/* Code ends here */
Hope, you had enjoyed this post. Thanks for reading this post.
Check out the video:
Stay tuned for more tutorials.
Stuff required:
- Arduino uno
- LED bargraph
- 220 ohm resistor
- connecting wires
Connections:
connections |
Upload the code below to your arduino board
/* Code starts from here */
const int led[]={4,5,6,7,8,9,10,11,12,13},d=5;
void setup() {
for(int i=0;i<10;i++)
pinMode(led[i],OUTPUT);
}
void loop() {
for(int i=0;i<10;i++)
{
digitalWrite(led[i],HIGH);
delay(d);
digitalWrite(led[i],LOW);
}
for(int j=0;j<8;j++)
{
digitalWrite(led[8-j],HIGH);
delay(d);
digitalWrite(led[8-j],LOW);
}
}
/* Code ends here */
Hope, you had enjoyed this post. Thanks for reading this post.
Check out the video:
Stay tuned for more tutorials.
https://electronicstextbook.blogspot.in/?m=1
ReplyDelete