uci-interrupt/examples/multi.js

29 lines
520 B
JavaScript
Raw Normal View History

import Interrupts from '../src/interrupts'
import Base from '@uci/base'
const PINS = [9,10,24]
let hook = (packet) =>
{
packet.cmd = 'pin.interrupt.find'
console.dir(packet)
return packet
}
let interrupts = new Interrupts(PINS,{hook:true, 10:{wait:200} })
interrupts.setHook(hook)
;
(async () => {
// console.log(await listener.init())
await interrupts.init()
interrupts.fire()
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
// process.kill(process.pid, 'SIGTERM')
})