CircuitPython pin or arbitrary predicate debouncer.
Project description
Introduction
Debounces an arbitrary predicate function (typically created as a lambda) of 0 arguments. The constructor also accepts a digital pin as a convienence.
Dependencies
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.
Usage Example
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')
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation
For information on building library documentation, please check out this guide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file adafruit-circuitpython-debouncer-1.3.11.tar.gz
.
File metadata
- Download URL: adafruit-circuitpython-debouncer-1.3.11.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6926f1325edf61ecef547b20aa8b78843f5a304cf7da93ed47b02dbceb7b0b0b |
|
MD5 | 4c1de26d66d17c39f5db5c897cc5e6e3 |
|
BLAKE2b-256 | 4ffbad32dadf71e06382a63437e7335a492a704a5ad648f2b63c85105a2aa8fe |