Concepts · Capacitors and RC timing
Mechanical buttons chatter when pressed, and a small resistor and capacitor can clean up that noise before the processor sees it.