This commit is contained in:
Skylar Grant 2024-08-21 22:18:38 -04:00
parent 4e4bf9f7ca
commit a0b0d16c73
2 changed files with 8 additions and 3 deletions

View File

@ -145,5 +145,12 @@ module.exports = {
});
}
}
},
handlers: {
stateChange(change) {
gpio.togglePin(pinMap[change.name].board).then(() => {
console.log(`Pin ${config.states[change.name].pin} set to ${change.on}`);
}).catch(e => console.error(e));
}
}
}

View File

@ -24,7 +24,5 @@ setInterval(() => {
comms.on('stateChange', (change) => {
console.log(`State change detected: ${change.name}`);
gpio.togglePin(config.states[change.name].board).then(() => {
console.log(`Pin ${config.states[change.name].pin} set to ${change.on}`);
}).catch(e => console.error(e));
fn.handlers.stateChange(change);
});