const int buttonPin = 7; // the number of the pushbutton pin const int ledPin = 8; // the number of the LED pin // Variables will change: int ledState = HIGH; // the current state of the output pin void setup() { pinMode(buttonPin, INPUT_PULLUP); pinMode(ledPin, OUTPUT); } int BLOCK_TIME = 250; int DEBOUNCE_TIME = 50; void loop() { // read the state of the switch into a local variable: int reading = digitalRead(buttonPin); //button pressed if (reading == LOW) { delay(DEBOUNCE_TIME); if (reading == LOW) { if (ledState == HIGH) ledState = LOW; else ledState = HIGH; digitalWrite(ledPin, ledState); delay(BLOCK_TIME); } } }