A new guide in the Adafruit Learning System today! Python Debouncer Library for Buttons and Sensors helps you cleanly detect switch state changes with no spurious noise detections.
We use switches a lot in our projects. Pushbutton switches, slide switches, micro switches. We also have touch sensors, light sensors, sound sensors, and many others.
These physical devices are messy. The change from one state to the other (e.g. pressing or releasing a button) bounces back and forth before settling into the new state. You can see this in the oscilloscope trace (above).
This guide introduces the adafruit_debouncer library and it’s Debouncer class. It starts with the basic usage and proceeds to more advanced capabilities.