Arduino Program for Turn On Led through Push Button
Arduino Program for Turn On Led through Push Button
Component Required
- Arduino Uno
- Breadboard
- Pushbutton
- Led
- jumper wires
Arduino Code
int led = 4;
int switch = 2;
void setup()
{
pinMode(led,OUTPUT);
pinMode(switchh,INPUT);
}
void loop()
{
if (digitalRead(switchh) == 0)
digitalWrite(led,HIGH);
else
digitalWrite(led,LOW);
}
No comments: