Monitor signal changes using gpiod.
Project description
gpiodmonitor
Tiny wrapper around gpiod used to monitor and debounce button presses.
Installation
You can isntall the package from pip
:
pip install gpiodmonitor
Needs libgpiod2 installed. Under Ubuntu / Debian you can it install using:
sudo apt install libgpiod2 python3-gpiod
Usage:
import gpiodmonitor
# set the chipnumber of your GPIO board (0 on the Raspberry Pi)
monitor = GPIODMonitor(0)
for pin in [17,23]:
# register some lambda to be called on activity on pins 17 and 23
monitor.register(pin,
on_pressed=lambda used_pin, time: print("{}: pressed".format(
used_pin)),
on_released=lambda used_pin, time: print("{}: released".format(
used_pin)))
# register a lambda to be called when the button is pressed for 3 seconds
duration=3
monitor.register_long_press(pin,
lambda used_pin, time: print("{}: pressed for {} secondes".format(
used_pin,duration)),
duration)
# will run infinitely
monitor.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gpiodmonitor-0.2.0.tar.gz
(6.8 kB
view details)
Built Distribution
File details
Details for the file gpiodmonitor-0.2.0.tar.gz
.
File metadata
- Download URL: gpiodmonitor-0.2.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5214b5b96bec635cddbe54e8af69c2d40f317463ae412b8566f051e5c8377aed |
|
MD5 | 2b89a98996b920b95390d8eba2fb9423 |
|
BLAKE2b-256 | eda02b1d6467682ea15f842d1f44e2b229fff91b0635fcc2d55d365e569ad853 |
File details
Details for the file gpiodmonitor-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: gpiodmonitor-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e0c31f9f6a3e989aa6f97bd7a866f726c4f459ad6b71661ae759df7a6c286ae |
|
MD5 | 2bc5d22ea219d7f73dc707908855e88c |
|
BLAKE2b-256 | ad86a67baa98831e8c31ef0094defc863bc681c92712dce94a1c7fa4d1b6a79b |