Code Monkey home page Code Monkey logo

cabinet-rs485-controller's Introduction

cabinet-rs-485-controller

npm npm

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,
})

cabinet-rs485-controller's People

Contributors

ckwcfm avatar

Watchers

 avatar

cabinet-rs485-controller's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.