int val = 1; int mode = 0; int led_pin = 7; int btn_pin = 8; void setup() { // initialize digital pin 13 as an output. pinMode(led_pin, OUTPUT); pinMode(btn_pin, INPUT); } // the loop function runs over and over again forever void loop() { val = digitalRead(8); if (val == LOW) { // check if the input is HIGH (button released) digitalWrite(led_pin, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led_pin, LOW); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second } }