Firmware · GPIO in practice
Counting button presses means telling when a press starts, not just that the button is down, and the loop speed matters here.