#define LED 3
#define BUTTON 4
void setup() {
pinMode(LED,OUTPUT);
pinMode(BUTTON,INPUT); //Define pin D2 as an input -> high impedance
}
void loop() {
if (digitalRead(BUTTON)==HIGH){ //Read the current state of the
//BUTTON pin
digitalWrite(LED,HIGH);
}
else{
digitalWrite(LED,LOW);
}
}