Button input pin uses Mega's internal pull-up resistor. Debouncing procedure adapted from https://www.arduino.cc/en/tutorial/debounce

Loop only waits for a button interrupt flag. Then it makes sure that the button has been pressed properly and is no longer bouncing. Then it turns the LED on or off.