const int LED_PIN = 7; const int BUTTON_PIN = 3; int buttonState = 0; void setup() { // put your setup code here, to run once: // initialized the LED pin as output pinMode(LED_PIN,OUTPUT); // initialized the pushbutton pin as an input pinMode(BUTTON_PIN,INPUT); } void loop() { // put your main code here, to run repeatedly: buttonState = digitalRead(BUTTON_PIN); if(buttonState == HIGH){ digitalWrite(LED_PIN,LOW); }else{ digitalWrite(LED_PIN,HIGH); } }