LED Chaser With Arduino
Hello friends. What's up? Hope doing well. Today we are going to make a simple but very interesting Piano with Buzzer and Arduino.
So let's started.............
Required Components:
1. Arduino
2. LED * 8 Pcs
3. Potentiometre 10k ohm [ You Can Change Delay Period Manually With This. ]
4. 100 ohm Resistor [ 1/4 watt ] * 8 Pcs
5. Breadboard
6. Some jumper wires.
Circuit Diagram:
Here is the circuit diagram.......
Code:
int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;
int led5 = 6;
int led6 = 7;
int led7 = 8;
int led8 = 9;
int poten = A0;
int delayperiod = 0;
int invalue;
void setup()
{
pinMode( led1, OUTPUT);
pinMode( led2, OUTPUT);
pinMode( led3, OUTPUT);
pinMode( led4, OUTPUT);
pinMode( led5, OUTPUT);
pinMode( led6, OUTPUT);
pinMode( led7, OUTPUT);
pinMode( led8, OUTPUT);
pinMode( poten, INPUT);
}
void loop()
{
invalue = analogRead(poten);
delayperiod = map(invalue,0,1023,0,1000);
digitalWrite(led1, HIGH);
delay(delayperiod);
digitalWrite(led2, HIGH);
delay(delayperiod);
digitalWrite(led3, HIGH);
delay(delayperiod);
digitalWrite(led4, HIGH);
delay(delayperiod);
digitalWrite(led5, HIGH);
delay(delayperiod);
digitalWrite(led6, HIGH);
delay(delayperiod);
digitalWrite(led7, HIGH);
delay(delayperiod);
digitalWrite(led8, HIGH);
delay(delayperiod);
digitalWrite(led1, LOW);
delay(delayperiod);
digitalWrite(led2, LOW);
delay(delayperiod);
digitalWrite(led3, LOW);
delay(delayperiod);
digitalWrite(led4, LOW);
delay(delayperiod);
digitalWrite(led5, LOW);
delay(delayperiod);
digitalWrite(led6, LOW);
delay(delayperiod);
digitalWrite(led7, LOW);
delay(delayperiod);
digitalWrite(led8, LOW);
delay(delayperiod);
}
Hurray...Our chaser is ready. Enjoy : )
Sir u are awesome... Your circuits are helping me. I want u to make more things in tinkercad
ReplyIt is not working
ReplyCan you help me out??
It will help me alot
bro mi serve il significato di tutto quello che ha fatto
Reply