cabinet-rs-485-controller

1.0.2 • Public • Published

cabinet-rs-485-controller

this controller make it easy to use this kind of rs485 controller board. You don't need to handle buffer cammand anymore

IMG_3701

Installation

npm install cabinet-rs-485-controller

Usage

const cabinetManager = require('cabinet-rs-485-controller')

const cabinet = 1
const doors = [1, 2, 6]
await cabinetManager.openDoors({ cabinet, doors })

const status = await cabinetManager.readAllDoorsOnCabinet({ cabinet })

cabinetManager will try to find the usb serial port. You can also use connect() to connect to your serical port

const cabinetManager = require('cabinet-rs-485-controller')

const devices = await cabinetManager.listDevices()
const { path } = devices[0]
cabinetManager.connect({ path })

Api

list serial port devices connected to your computer

const devices = await cabinetManager.listDevices()

connect to serial port device

await cabinetManager.connect({ path })

open one door on specific cabinet

const { status } = await cabinetManager.openDoor({ cabinet: 1, door: 1 })

open multiple doors on specific cabinet

const feedback = await cabinetManager.openDoors({
  cabinet: 1,
  doors: [1, 2, 9],
})

open all door on specific cabinet

const feedback = await cabinetManager.openAllDoorsOnCabinet({ cabinet: 1 })

open all door on all cabinets

await cabinetManager.openAllDoors({ cabinet: 1 })

read all doors's status on specific cabinet

const { cabinet, doors } = await cabinetManager.readAllDoorsOnCabinet({
  cabinet: 1,
})

Readme

Keywords

none

Package Sidebar

Install

npm i cabinet-rs-485-controller

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

12.4 kB

Total Files

5

Last publish

Collaborators

  • ckwcfm