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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,3 +2,4 @@
|
||||
const gpio = require('./custom_modules/VoidGPIO.js');
|
||||
|
||||
gpio.debugInit();
|
||||
gpio.pollingLoop();
|
Loading…
Reference in New Issue
Block a user