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

File metadata

File hashes

Hashes for adafruit-circuitpython-debouncer-2.0.3.tar.gz
Algorithm Hash digest
SHA256 57b48d80721db85111b6dd30e2ddc89cbf7c014f5d3a4b5267e66e50f44d5da3
MD5 4f7f2e4082236faf0aeb6c9eba9e1d10
BLAKE2b-256 cf2f865f0cbd419ada3bbbb7ff7405fe86ffa78b965f0e058b6f1ab8100363a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a95e8a6cf972183aba3fc8bbd7daa2cec60be22014e8f11fdbbece6d4cf45906
MD5 a0db39c25626ccedb73125c17890e91e
BLAKE2b-256 e7f80d5ad3d1bd0fb860a4e27b0be57fb9666bfee6fb401c434f8e0350d1b37e

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