This video demonstrates the usage of timers to counter external events.
The LED will turn on when two pulses from the push button is detected and off when single pulse is detected.
Check out the guide from here:
https://blog.embeddedexpert.io/?p=2323