Testing polling loop
This commit is contained in:
parent
486c3aaa62
commit
c3e70ab9c7
@ -109,5 +109,16 @@ module.exports = {
|
||||
break;
|
||||
}
|
||||
};
|
||||
},
|
||||
async pollingLoop() {
|
||||
for (const pin of pins) {
|
||||
if (pin.mode === 'IN') {
|
||||
this.readPin(pin.board, (err, state) => {
|
||||
if (err) throw err;
|
||||
console.log(`${pin.key}: ${state} [def: ${pin.defaultState}]`);
|
||||
sleep(1000).then(this.pollingLoop);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
// Import modules
|
||||
const gpio = require('./custom_modules/VoidGPIO.js');
|
||||
|
||||
gpio.debugInit();
|
||||
gpio.debugInit();
|
||||
gpio.pollingLoop();
|
Loading…
Reference in New Issue
Block a user