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

File metadata

File hashes

Hashes for adafruit-circuitpython-debouncer-2.0.8.tar.gz
Algorithm Hash digest
SHA256 cc8f54c19dc3b8c1bfcf0afd3b33f3b9e62dbf681339fb953c64fee3ac2cf0c9
MD5 d1f9cad20107e8fe84d4745cb919b525
BLAKE2b-256 fa711caf2a89cc2dcdb5b0aa645ecc30254f1fb70aaf7fc2404486485b38c23d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b0c4100f39c14ebc590e79c74fda1df8e49ef890ecdfe0bafd6cf4297fc58e22
MD5 cd17a0923763f4dbf74e1907de06c204
BLAKE2b-256 39ab8d86791701381665c28eb0fabf0d5530fc08813e3ea69180a84ef0e0de72

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