uci-i2c-bus/examples/bus.js

18 lines
453 B
JavaScript

/*
* Basic i2c bus listening at 1776 (by default when tcp:true) and also named pipe
*
*/
import Bus from '../src/bus-packet'
// can use SOCKETS_DIR='' env variable to get a 'i2c-bus.sock' in the given environment variable path
// 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)
})