If you are using the latest gpiod (v2.1.3) from PyPI then the examples in the libgpiod source tree should work for you - you just need to modify them to select the correct line.
You can check what lines are available and on what GPIO chip using the gpioinfo tool from the gpiod package. For Pi5 the external GPIOs are on gpiochip4, whereas for older Pis they are on gpiochip0.
You can check what lines are available and on what GPIO chip using the gpioinfo tool from the gpiod package. For Pi5 the external GPIOs are on gpiochip4, whereas for older Pis they are on gpiochip0.
If you want to know when the button is pressed, look at the watch_line_value.py example - that blocks until the edge event (i.e. the button is pushed), rather than polling.Appreciate your input brother. In your opinion, what would be a better approach? Adding a tiny sleep between loops? I need to check the status of a button in my current program and would greatly appreciate experienced advice!
Statistics: Posted by warthog618 — Tue Apr 02, 2024 2:53 pm