Add gpio.js test file
This commit is contained in:
parent
32625bbbde
commit
996e0ca81a
|
@ -0,0 +1,13 @@
|
|||
'use strict'
|
||||
|
||||
const Gpio = require('onoff').Gpio
|
||||
|
||||
const btn = Gpio(18, 'in', 'both')
|
||||
|
||||
console.log('Watching input on button 18')
|
||||
btn.watch((err, val) => {
|
||||
if (err) {
|
||||
return console.error(err)
|
||||
}
|
||||
console.log(val)
|
||||
})
|
Loading…
Reference in New Issue