Buttons not working on GPIO Hat

January 5, 2024, 21:31

trinerk

Ok, I have solved every problem I have had and this is the last hurdle. I have this HAT and following the documentation: https://www.waveshare.com/wiki/1.44inch_LCD_HAT Except in the demos in C and Python the button presses on the hat do not get detected. I manually wrote a script in python to output ot the console when a button is pressed by following this guide (it uses RPIO): https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/ With the Waveshare Demo and that guide, it does still not detect any button presses. I am a bit lost on how to test it.

k9t33n

try and look at the documentation to find which gpio pins are effected by each button

trinerk

I did, I saw "gpio=6,19,5,26,13,21,20,16=pu" And in the docs these pins correspond to buttons. In the RPIO demo I maid I referenced pin 21 which is a button, and did not return anything when pressed

k9t33n

use this code (the button one) but do it for every one of those pins

trinerk

let me test it now

k9t33n

and then when you see the print statements you know which button does what. then you can wire it up that way

trinerk

thank you

trinerk

legend

trinerk

it worked

k9t33n

np