From 88159635c08e36fe947546dd68b0602f70cf2346 Mon Sep 17 00:00:00 2001 From: "Christopher C. Mills" Date: Fri, 14 Jun 2024 19:06:09 -0500 Subject: [PATCH 1/2] Fixed ambiguous GPIO numbers in buttons.py example code --- examples/7color/buttons.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/7color/buttons.py b/examples/7color/buttons.py index c699b4d..17e4278 100755 --- a/examples/7color/buttons.py +++ b/examples/7color/buttons.py @@ -17,8 +17,15 @@ # GPIO pins for each button (from top to bottom) # These will vary depending on platform and the ones # below should be correct for Raspberry Pi 5. -# Run "gpioinfo" to find out what yours might be -BUTTONS = ["PIN29", "PIN31", "PIN36", "PIN18"] +# Run "gpioinfo" to find out what yours might be. +# +# Raspberry Pi 5 Header pins used by Inky Impression: +# PIN29, PIN31, PIN36, PIN18. +# These header pins correspond to BCM GPIO numbers: +# GPIO05, GPIO06, GPIO16, GPIO24. +# These GPIO numbers are what is used below and not the +# header pin numbers. +BUTTONS = [5, 6, 16, 24] # These correspond to buttons A, B, C and D respectively LABELS = ["A", "B", "C", "D"] From 6aa87b47093f6cbb25ca55f65ce656055606c0c8 Mon Sep 17 00:00:00 2001 From: "Christopher C. Mills" Date: Fri, 14 Jun 2024 19:21:53 -0500 Subject: [PATCH 2/2] Reworked print statement to reflect GPIOs are being displayed --- examples/7color/buttons.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/7color/buttons.py b/examples/7color/buttons.py index 17e4278..494e6d7 100755 --- a/examples/7color/buttons.py +++ b/examples/7color/buttons.py @@ -50,9 +50,9 @@ # It receives one argument: the associated gpiod event object. def handle_button(event): index = OFFSETS.index(event.line_offset) - pin = BUTTONS[index] + gpio_number = BUTTONS[index] label = LABELS[index] - print(f"Button press detected on pin: {pin} label: {label}") + print(f"Button press detected on GPIO #{gpio_number} label: {label}") while True: