#define LED 7 // define the led pin #define BTN 3 // define the button pin // run only once void setup() { // set the led pin like output pinMode(LED, OUTPUT); // set the button pin like input // pinMode(BTN, INPUT); // if you have an external PULL-UP or PULL-DOWN move '//' in the line below pinMode(BTN, INPUT_PULLUP); } // run in loop void loop() { if (digitalRead(BTN)) { // run only if the button is not pressed (with PULL-UP) digitalWrite(LED, HIGH); // turn on the led delay(50); // wait 50 millisecond digitalWrite(LED, LOW); // turn off the led delay(50); // wait 50 millisecond } // END if delay(1); // wait 1 millisecond }