From 47abb3b8e5cb8f769ce71af9f6989114fb9ac647 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Sat, 16 Sep 2017 14:54:40 -0400 Subject: [PATCH] Watch not responding to shorts, use set interval with a readSync() --- tests/gpio.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/gpio.js b/tests/gpio.js index e452b42..88d655a 100644 --- a/tests/gpio.js +++ b/tests/gpio.js @@ -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) -}) \ No newline at end of file +})*/ + +setInterval(() => { + console.log(btn.readSync()) +}, 1000) \ No newline at end of file