displayhatmini-python
displayhatmini-python copied to clipboard
RuntimeError: Failed to add edge detection
When running the pwm-backlight.py and pygame-button-interrupt.py demos, I got the following error:
Traceback (most recent call last):
File "/home/thomas/displayhatmini/displayhatmini-python/examples/pwm-backlight.py", line 43, in <module>
displayhatmini.on_button_pressed(button_callback)
File "/home/thomas/displayhatmini/env/lib/python3.11/site-packages/displayhatmini/__init__.py", line 99, in on_button_pressed
GPIO.add_event_detect(pin, GPIO.BOTH, callback=callback)
RuntimeError: Failed to add edge detection
I was able to solve it by running:
sudo apt remove python3-rpi.gpio
python -m pip install rpi-lgpio
(while my venv was active) (source).
Perhaps worth updating at least the readme if this is not directly fixable in the examples.