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

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.13.tar.gz
Algorithm Hash digest
SHA256 804804e347588e4e18ad19c129cf894590db8ac68e0226baef9094a528108059
MD5 caf13200a44850722e9579b9278b43f4
BLAKE2b-256 12c36c674d1ad1436baba0d251957edc0946e2ab322d0934341ad978234f7f59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_debouncer-2.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 9aa63e96c0dd5387f3a7b538f007dbb52b2b0819686979435b73f320144d6fee
MD5 26b4513654711762c97434bd00163f35
BLAKE2b-256 50a912a52d47e80af15f5a7dbd764adde757a6d8c855d4a44eecd7cf1718f6c8

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