Debounces an arbitrary predicate function (typically created as a lambda) of 0 arguments. The constructor also accepts a digital pin as a convienence.
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
import board import digitalio from adafruit_debouncer import Debouncer pin = digitalio.DigitalInOut(board.D12) pin.direction = digitalio.Direction.INPUT pin.pull = digitalio.Pull.UP switch = Debouncer(pin) while True: switch.update() if switch.fell: print('Just pressed') if switch.rose: print('Just released') if switch.value: print('not pressed') else: print('pressed')
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.