PI-13Raspberry Pi PicoIntermediatePremium

Raspberry Pi Pico Button Debounce: IRQ vs Software Polling

If one press of a button made your code count 3-4 times, the culprit is contact bounce: the button's metal contacts open and close many times within microseconds as they touch! In this project we count the same button in 2 different ways and compare them side by side in Serial: RAW polling (catches the bounce and miscounts) and IRQ + software debounce (counts correctly).

0.0(0)
12 completed
Raspberry Pi Pico Button Debounce: IRQ vs Software Polling
If you press a button once and the device counts three or four presses, the culprit is the metal contacts bouncing inside it. In this project the same button is counted in two ways: one treats every bounce as a new press and overcounts, the other ignores the short bounces and gets it right, and you see both numbers side by side on your computer screen. The LED also flips on or off with every correctly counted press.

Source Code

Premium Content

The source code, block version and FAQ of this project are open to Premium members.

  • All Project Code
  • Block version
  • Frequently Asked Questions