adafruit_debouncer

Debounces an arbitrary predicate function (typically created as a lambda) of 0 arguments. Since a very common use is debouncing a digital input pin, the initializer accepts a pin number instead of a lambda.

  • Author(s): Dave Astels

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_debouncer.Debouncer(io_or_predicate, interval=0.01)

Debounce an input pin or an arbitrary predicate

current_duration

Return the time since the most recent transition.

fell

Return whether the debounced value went from high to low at the most recent update.

last_duration

Return the amount of time the state was stable prior to the most recent transition.

rose

Return whether the debounced value went from low to high at the most recent update.

update()

Update the debouncer state. MUST be called frequently

value

Return the current debounced value.