uci-i2c-bus/examples/bus.js

18 lines
487 B
JavaScript
Raw Normal View History

/*
* Basic i2c bus listening at 1776 (by default when tcp:true) and also named pipe 'i2c-bus' by default in default /tmp directory
*
*/
import Bus from '../src/bus'
// can use SOCKETS_DIR='' env variable to get a 'i2c-bus.sock' in a particular directory
// e.g. SOCKETS_DIR=/opt/sockets node -r @std/esm i2cbus
;
(async () => {
let i2cbus = new Bus({id:'i2c-bus',tcp:true})
await i2cbus.init()
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})