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

adafruit-circuitpython-debouncer-2.0.5.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file adafruit-circuitpython-debouncer-2.0.5.tar.gz.

File metadata

File hashes

Hashes for adafruit-circuitpython-debouncer-2.0.5.tar.gz
Algorithm Hash digest
SHA256 3bbff564cfc8731c5a81d82e4562c68bc7d7c7d4cb80b7780805673fe5681f2c
MD5 f9ba9eee1a9afb7dddf06c0bc0c2054f
BLAKE2b-256 64748fe1bdb2462e0261838694090900a3c78cee5908083435d4ccd3f7d12bae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2484419e61ed6378b5cb7b0bc3dc71ea0104560e5b10b782521388a95b42b528
MD5 9f831b3aa50fec0e9694bde3e9370bfc
BLAKE2b-256 f11a45183e77d19559657b6b4eff42b22ae42f72496b781bb4aeeba3ad11402e

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