Buttons and switches are notorious for “bounce” – when a button is pressed, the contacts do not separate cleanly leading to multiple spikes. This can be seen in Figure 11.6 which illustrates the actual behavior as captured on an oscilloscope – the top trace shows the voltage at the PA0 when the button is pressed and the lower trace when the button is released