28 lines
677 B
JavaScript
28 lines
677 B
JavaScript
|
import Base from '@uci/base'
|
||
|
|
||
|
// const HOST = 'localhost'
|
||
|
const HOST = 'pine64.kebler.net'
|
||
|
const PORT = 9075
|
||
|
let client = new Base({sockets:'client#c>t', client:{host:HOST, port:PORT}, id:'gpios-client'})
|
||
|
|
||
|
|
||
|
// client.c.reply = async function (packet) {
|
||
|
// return new Promise((resolve) => {
|
||
|
// console.log('reply from gpio with packet')
|
||
|
// console.dir(packet)
|
||
|
// resolve()
|
||
|
// })
|
||
|
// }
|
||
|
|
||
|
;
|
||
|
(async () => {
|
||
|
|
||
|
await client.init()
|
||
|
console.log('RETURN', await client.send({cmd: 'on', pins:'all'}))
|
||
|
// console.log('RETURN', await client.send({cmd: 'off', pins:'all'}))
|
||
|
process.exit()
|
||
|
|
||
|
})().catch(err => {
|
||
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
||
|
})
|