Hi folks!
I'm currently working on a little project that involves a Raspberry Pi (an old RPi 2 Model B) and a couple of buttons. I'm writing the software in Go(lang) with periph.io as abstraction over the GPIO layer. I have a couple of questions, which I've made bold below for your convenience
The library has a method to wait for edge events on a specified pin (WaitForEdge(timeout time.Duration) bool), and I'm noticing multiple edge events for single button presses. I am assuming I'm doing something wrong, but I'm not entirely sure what.
I have tried:
Both result in a varying number of edge events. Sometimes just two (expected, I'm watching both edges), sometimes 3, sometimes anywhere from 4 - 10. The button I actually intend to use is a three pin one (VCC, GND, S) which makes the S pin high on press, so I'm guessing the pull down option is the only viable one there.
Now this could be in the Go library I'm using of course, although I think it's pretty a pretty widely used and and if it had these kinds of issues, they would've probably surfaced before, so I'm still assuming I'm at fault and not the library (it claims to basically proxy the edge events straight from the OS/hardware).
Q1: Is there a way to read low level GPIO edge events directly on the Pi via SSH, so I can verify if there are indeed multiple edge events being triggered?
I have also seen examples online of people using capacitors in their button > GPIO circuits. Now I am currently working my way through an electronics course, but am doing so in parallel with practical experimentation and although I've learned roughly what a capacitor is/does, I'm not sure if and how it could aid in this button circuit.
Q2: Could a capacitor help create a steadier signal on the GPIO pin, so it'll more reliably trigger a single edge event on press and one on depress of the button?
Thanks in advance for your time and effort!
I'm currently working on a little project that involves a Raspberry Pi (an old RPi 2 Model B) and a couple of buttons. I'm writing the software in Go(lang) with periph.io as abstraction over the GPIO layer. I have a couple of questions, which I've made bold below for your convenience
The library has a method to wait for edge events on a specified pin (WaitForEdge(timeout time.Duration) bool), and I'm noticing multiple edge events for single button presses. I am assuming I'm doing something wrong, but I'm not entirely sure what.
I have tried:
- Setting the pin to Pull Down and using the button to connect 3V3 and the GPIO pin.
- Setting the pin to Pull Up and using the button to connect Ground and the GPIO pin.
Both result in a varying number of edge events. Sometimes just two (expected, I'm watching both edges), sometimes 3, sometimes anywhere from 4 - 10. The button I actually intend to use is a three pin one (VCC, GND, S) which makes the S pin high on press, so I'm guessing the pull down option is the only viable one there.
Now this could be in the Go library I'm using of course, although I think it's pretty a pretty widely used and and if it had these kinds of issues, they would've probably surfaced before, so I'm still assuming I'm at fault and not the library (it claims to basically proxy the edge events straight from the OS/hardware).
Q1: Is there a way to read low level GPIO edge events directly on the Pi via SSH, so I can verify if there are indeed multiple edge events being triggered?
I have also seen examples online of people using capacitors in their button > GPIO circuits. Now I am currently working my way through an electronics course, but am doing so in parallel with practical experimentation and although I've learned roughly what a capacitor is/does, I'm not sure if and how it could aid in this button circuit.
Q2: Could a capacitor help create a steadier signal on the GPIO pin, so it'll more reliably trigger a single edge event on press and one on depress of the button?
Thanks in advance for your time and effort!