Closed NV4RE closed 5 years ago
This has been working pretty well for me:
function pushed(pin) {
// wait a bit to make sure we aren't bouncing
rpio.msleep(20)
// if the pin is no longer down, assume it was just a bounce
if(rpio.read(pin)) return
// at this point, the pin is still down so assume it's a real push
console.log('button pushed')
}
rpio.open(buttonPin, rpio.INPUT, rpio.PULL_UP)
rpio.poll(buttonPin, pushed, rpio.POLL_DOWN)
I quite like this workaround and may add something similar as a note to the documentation.
I added this in 04378da6dc3c75da1dd8d0b42886ef760eefd5aa
Hello, This module work very nice, and it's cover almost all use case, easy to install. But sometime rpio.poll call rapidly
(Pin 7 connected to contact relay)
OUTPUT