Four LED blinking in pattern programming by ARDUINO
//program for 4 LED blinking one by one
//by-ALOK KUMAR PANDEY
//..........................................................................................//
int led1=13, led2 = 12, led3 = 11, led4 =10; // All pin are difined by variables
void setup()
{
pinMode(led1, OUTPUT); // here pin 13(i.e. led1) set as output pin
pinMode(led2, OUTPUT); // here pin 12(i.e. led2) set as output pin
pinMode(led3, OUTPUT); // here pin 11(i.e. led3) set as output pin
pinMode(led4, OUTPUT); // here pin 10(i.e. led4) set as output pin
}
void loop()
{
digitalWrite(led1, HIGH); // here we set led1 as high(i.e. pin no. 13) it means led1 get on.
delay(1000); //delay of one second
digitalWrite(led1,LOW); // here we set led1 as low(i.e. pin no. 13) it means led1 get off.
digitalWrite(led2, HIGH); // here we set led2 as high(i.e. pin no. 12) it means led1 get on.
delay(1000); //delay of one second
digitalWrite(led2,LOW); // here we set led2 as low(i.e. pin no. 12) it means led1 get off.
digitalWrite(led3, HIGH); // here we set led3 as high(i.e. pin no. 11) it means led1 get on.
delay(1000); //delay of one second
digitalWrite(led3,LOW); // here we set led3 as low(i.e. pin no. 11) it means led1 get off.
digitalWrite(led4, HIGH); // here we set led4 as high(i.e. pin no. 10) it means led1 get on.
delay(1000); //delay of one second
digitalWrite(led4,LOW); // here we set led4 as low(i.e. pin no. 10) it means led1 get off.
//delay(1000); //delay of one second
}
Comments
Post a Comment