uci-mcp/examples/mcp17.js

24 lines
778 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 MCP230XX from '../src/mcp230xx-packet'
// const PATH = ''
;
(async () => {
// let chip8 = new MCP230XX({id:'mcp8-27', address:0x27, nmcp: { path: '/opt/sockets/mcp2.sock' }})
let chip17 = new MCP230XX({id:'mcp17-26', chip17:true, address:0x26})
await chip17.init()
// await chip8.init()
console.log(await chip17.pin.cfg({pins:'all'}))
// console.log(await chip17.pin.cfg({pins:'all', cfg:'toggle_switch'}))
// console.log(await chip17.pin.cfg({pins:'all', port:'B', cfg:'toggle_switch'}))
// console.log(await chip8.pin.cfg({pins:'all', cfg:'toggle_switch'}))
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})