Skip to content
CircuitPython pin or arbitrary predicate debouncer
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs In response to comments Jan 5, 2019
examples
.gitignore
.pylintrc Trying this again Jan 4, 2019
.readthedocs.yml
.travis.yml Trying this again Jan 4, 2019
CODE_OF_CONDUCT.md Trying this again Jan 4, 2019
LICENSE Trying this again Jan 4, 2019
README.rst
adafruit_debouncer.py Rename properties to conform to lint rules Aug 14, 2019
requirements.txt Trying this again Jan 4, 2019

README.rst

Introduction

Documentation Status Discord Build Status

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')

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation

For information on building library documentation, please check out this guide.

You can’t perform that action at this time.