I’ve just received my Impression 7.3" display, and it’s truly beautiful. I’ve been using the 5.7" device for years and loved it, but this new one pops so much more. Well done!
While trying out the demo apps included I’ve run into an issue with the buttons.py application.
It immediate exits with:
Traceback (most recent call last):
File “/home/pi/Pimoroni/inky/examples/7color/./buttons.py”, line 4, in
import gpiodevice
ModuleNotFoundError: No module named ‘gpiodevice’
I’ve then run the following to install gpiodevice (yes, I know I’ve used the break-system-packages flag):
pip3 uninstall gpiodevice --break-system-packages
And now it fails with:
Woah there, suitable gpiochip device not found!
❌ /dev/gpiochip0: this is not the GPIO we’re looking for! (pinctrl-bcm2835)
Apologies for replying to my own message - I couldn’t see a way to edit the original with my findings.
After a lot of frustration with this I decided to test it with gpiozero instead of using RPi.GPIO and it’s working perfectly after some minor code changes.
So, using GPIO version 0.7.1a4 didn’t work, but swapping out to gpiozero (version 2.0 was installed) has met with success.
Here’s the buttons.py code edited to use the gpiozero library instead, if anyone is interested.
#!/usr/bin/env python3
import signal
from gpiozero import Button
print("""buttons.py - Detect which button has been pressed
This example should demonstrate how to:
1. set up gpiozero to read buttons,
2. determine which button has been pressed
Press Ctrl+C to exit!
""")
# Gpio pins for each button (from top to bottom)
BUTTONS = [5, 6, 16, 24]
# These correspond to buttons A, B, C and D respectively
LABELS = ['A', 'B', 'C', 'D']
# "handle_button" will be called every time a button is pressed
# It receives one argument: the associated input pin.
def handle_button(pin):
label = LABELS[BUTTONS.index(pin.pin.number)]
print("Button press detected on pin: {} label: {}".format(pin.pin.number, label))
# Loop through out buttons and attach the "handle_button" function to each
# Buttons connect to ground when pressed, so we should set them up
# with a "PULL UP", which weakly pulls the input signal to 3.3V.
# We're picking a generous bouncetime of 250ms to smooth out button presses.
for pin in BUTTONS:
button = Button(pin=pin, pull_up=True, bounce_time=0.250)
button.when_pressed = handle_button
# Finally, since button handlers don't require a "while True" loop,
# we pause the script to prevent it exiting immediately.
signal.pause()
Are you running Bookworm (Pi OS 12) on that Pi?
If yes, I’m thinking its changes made to that release for the new Pi 5. The Pi 5 has the RP1 chip which interfaces with the GPIO. That entailed lots of software changes to interface with the GPIO. I’m thinking some changes happen even if you don’t install Bookworm on a Pi 5.
I’m running Pi OS Legacy on everything except my Pi 5. It’s just my personal choice. IMHO it makes software installs a lot easier. The new PIP virtual environment stuff just makes my head hurt. =(