add example
This commit is contained in:
parent
6d5f7faa69
commit
200cf61089
19
index.js
Normal file
19
index.js
Normal file
@ -0,0 +1,19 @@
|
||||
const DevObj = require('./deviceObject')
|
||||
|
||||
;(async function () {
|
||||
|
||||
let list = await DevObj.getPorts()
|
||||
console.log('get port list :::: ', list)
|
||||
|
||||
let dev = new DevObj('/dev/tty.SLAB_USBtoUART', null)
|
||||
dev.on('open', () => {
|
||||
console.log('dev open')
|
||||
}).on('close', () => {
|
||||
console.log('dev close')
|
||||
})
|
||||
|
||||
dev.connect()
|
||||
|
||||
}()).then(() => {}).catch(err => {
|
||||
console.log(err)
|
||||
})
|
Loading…
Reference in New Issue
Block a user