Testing polling loop

This commit is contained in:
Skylar Grant 2024-08-18 13:59:11 -04:00
parent 486c3aaa62
commit c3e70ab9c7
2 changed files with 13 additions and 1 deletions

View File

@ -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);
});
}
}
}
}

View File

@ -1,4 +1,5 @@
// Import modules
const gpio = require('./custom_modules/VoidGPIO.js');
gpio.debugInit();
gpio.debugInit();
gpio.pollingLoop();