Share Info With Your Friends

       
   

Arduino Basic Project on LED Blinking Using Switch/Button

In this project we are reading the value of switch and depending upon the switch value we are going to on or off the LED.
Basically we are using here push button.

Things Required to built this project:-

  1. Arduino Board
  2. Push Button.
  3. LED
  4. Connecting Wire.

Circuit Diagram:-

Arduino Basic Project on LED Blinking Using Switch/Button

Code/Program:-

void setup() {
  // put your setup code here, to run once:
  pinMode(13,OUTPUT);
  pinMode(2,INPUT_PULLUP);
}
int i;
void loop() {
  // put your main code here, to run repeatedly:
  if(digitalRead(2)==1)
  {
    for(i=0;i<5;i++)
    {
      digitalWrite(13,1);
      delay(1000);
      digitalWrite(13,0);
      delay(1000);
    }
  }
  else
  digitalWrite(13,0);
}
Previous
Next Post »

Thanks for your feed back we will soon reply you EmoticonEmoticon