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.15.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.15.tar.gz.

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.15.tar.gz
Algorithm Hash digest
SHA256 e4706471d59377d379002a762c1316c0024e71e17b5380b980450f6623bc3a7c
MD5 b3cf833fcd0339e3b453d7bd4e0121c5
BLAKE2b-256 a06e82f2aef6bd65e9a205715a8f62ccb72b95185dc40d42c03a93bb316b144c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 bc9d25243bd8e301db8176a4b30140a0b5f6036c6c2c07874456e26e6f27b95e
MD5 d88dfa40d1368bb0bf6abb0c9e0597d8
BLAKE2b-256 47ac79bbe7e07e0d1ed8d493e787e9cf8e052e08d66b3834b397502a062e95a5

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