uci-i2c-bus/examples/bus.js

21 lines
537 B
JavaScript

/*
* 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
const CONCURRENCY = 1
;
(async () => {
let i2cbus = new Bus({id:'i2c-busx',tcp:true, concurrency:CONCURRENCY})
await i2cbus.init()
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})