Button press toggles internal LED.

We're using a pullup resistor to keep the BUTTON pin HIGH. When the button is pressed, the button pin momentarily changes to LOW. Variables buttonState and ledState and clever if-clauses toggle the internal LED only when the button has just been pressed.


The solution is not perfect. A technique to debounce the button is missing.