dvd
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Im using
GpioController
to control the GPIO pins on my Raspberry pi, i have a breakout board with some LEDs on it and a couple of buttons.
Controlling the leds has been pretty easy so far, as they are not something I have to actively listen to but I'm trying to make a method that will listen to all connected buttons (there are total of 6 of them) and do something based on when they are pressed (For testing im simply trying to print to console with their respective button number)
I've tried a couple of things, but Im having issues in their behavior (you press once, it keeps going off for eternity) and in general I think I'm doing it in a convoluted way.
Does anyone know the best method to listen for button presses (on the background) and then upon button press allow them to execute a piece of code?
the extent of what I have tried so far mainly revolves around opening all pins that are buttons
I have no idea if this is the right approach and any pointers would be greatly appreciated62 replies