Closed JohnnyHandy closed 5 years ago
Unfortunately I was not able to put it to work using the rpio.poll function
However, I managed to listen to the input pin by using a setInterval() method:
function status(){
rpio.open(15, rpio.INPUT, rpio.PULL_UP);
setInterval(function(){
var status = rpio.read(15)
console.log(status)
},1000)
}
I did try to listen every second, which was enough for the purpose in which I wanted to work, but if anyone try with a smaller interval, it might work as well.
I am sorry if this question is antiquate, but what is the proper circuit used to ellaborate the push button example? I am running into trouble when I try to make it work, and I am almost certain that I might be connecting things wrongly on my breadboard...
Edit: I found this guid: https://github.com/raspberrypilearning/physical-computing-guide/blob/master/pull_up_down.md and I am using the circuits that are being show at it. However, it does not work. It looks like that whenever I use the rpio.poll, my server-side application (which I am using nodejs and express to serve it) breaks, and I am forced to restart my raspberry... Anyone know any fix to it?
Edit2: I am using the following code to execute the polling function whenever the server starts:
the function "buttonPress" :