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.
Basically we are using here push button.
Things Required to built this project:-
- Arduino Board
- Push Button.
- LED
- Connecting Wire.
Circuit Diagram:-
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);
}
Thanks for your feed back we will soon reply you EmoticonEmoticon