Watch not responding to shorts, use set interval with a readSync()
This commit is contained in:
parent
c8f9236a9d
commit
47abb3b8e5
|
@ -2,12 +2,17 @@
|
|||
|
||||
const Gpio = require('onoff').Gpio
|
||||
|
||||
const btn = Gpio(12, 'in', 'both')
|
||||
const btn = Gpio(18, 'in', 'both')
|
||||
|
||||
console.log('Watching input on button 18')
|
||||
btn.watch((err, val) => {
|
||||
|
||||
/*btn.watch((err, val) => {
|
||||
if (err) {
|
||||
return console.error(err)
|
||||
}
|
||||
console.log(val)
|
||||
})
|
||||
})*/
|
||||
|
||||
setInterval(() => {
|
||||
console.log(btn.readSync())
|
||||
}, 1000)
|
Loading…
Reference in New Issue