Skip to main content

CircuitPython pin or arbitrary predicate debouncer.

Project description

Introduction

Documentation Status Discord Build Status Code Style: Ruff

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

adafruit_circuitpython_debouncer-2.0.14.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.14.tar.gz
Algorithm Hash digest
SHA256 339e06994c197e6966ad4cf8edcaef0e98f8966d22c43f0b0dbcca113ff3dec1
MD5 910fd0d4141024466964c1423d28b2da
BLAKE2b-256 35c00bcb907d9451046110e40e1c543d109cab2e51f796f699bf76b2e302dd2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 e6c6dfac75e6c725d1ff0498ec273899e7bb79eaca2cb9f7871af249ecb15d21
MD5 7dc32809e9fb406490a83491fbafb48b
BLAKE2b-256 a94c16ea71e8daf8a187de2bac9b897db9a4bd29d8e3d907b1d9a7ad08cdf67c

See more details on using hashes here.

Supported by

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