uci-i2c-bus/examples/bus.mjs

21 lines
456 B
JavaScript
Raw Normal View History

/*
* i2c bus with both unix and tcp socket using defaults. For TCP that is host OS name and port 8080
*
*/
import Bus from '../src/bus-packet'
const delay = time => new Promise(res=>setTimeout(()=>res(),time))
;
(async () => {
// let i2cbus = new Bus({id:'i2c-bus', log:true})
let i2cbus = new Bus({id:'i2c-bus', sockets:'us,ts', log:true})
await i2cbus.init()
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})