Skip to main content

CircuitPython pin or arbitrary predicate debouncer.

Project description

Introduction

Documentation Status Discord Build Status Code Style: Black

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')

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file adafruit_circuitpython_debouncer-2.0.9.tar.gz.

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.9.tar.gz
Algorithm Hash digest
SHA256 b5149a422969a830146773a442235acdf69276768e1b14d57dddbd96cc8a396d
MD5 5361d6a9e9994ad285fe85f27e2690a1
BLAKE2b-256 cffb4e0ce9983a0be7edfc99049cb014c16de4d1d2a4488a34d2ca608dabccc4

See more details on using hashes here.

File details

Details for the file adafruit_circuitpython_debouncer-2.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 dfd2d7777e55b3fa620b2d1eefbdf2abcdc1d22fc03168c682fb5d8375cc5264
MD5 313d765806903635bbb0a16e647d1457
BLAKE2b-256 fd2d0881d9cea64d2fb021c54edf839f5f8a6ddd26209539a5e1946ba52979ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page