const uint8_t ledPin = 13 ;
const uint8_t button_switch = 2; // external interrupt pin
const unsigned long debounceDelay = 300 ;    // the debounce time; increase if the output flickers

void button_interrupt_handler()
{
  static uint32_t last_entryAtMs = 0 ;
  if ( millis() - last_entryAtMs > debounceDelay ) {
    digitalWrite( ledPin, ! digitalRead(ledPin)) ;  // toggle led
    last_entryAtMs = millis() ;
  }

}

void setup() {
  Serial.begin(115200);
  pinMode( ledPin, OUTPUT) ;
  pinMode( button_switch, INPUT_PULLUP) ;
  attachInterrupt(digitalPinToInterrupt(button_switch), button_interrupt_handler, FALLING);
}

void loop() {}