/UI021-usbrelay-node-modules

a usb relay nodejs library for UI021

Primary LanguageCGNU General Public License v3.0GPL-3.0

UI021-usbrelay-node-modules

a usb relay nodejs library for UI021

link: http://freeeasy-life.com/product/ui_mod/ur

##usage

setRelay([deviceId], [portId], [status])

set usbrelay on deviceId(1n) and portId(1126) to status(1=on, 0=off) return value is 0 (ok) or -1 (error)

getRelay([deviceId], [portId])

get usbrelay status on deviceId(1n) and portId(1126) return value is current status 1 (on), 0 (off) or -1 (error)

toggleRelay([deviceId], [portId])

toggle usbrelay on deviceId(1n) and portId(1126) return value is current status after toggle: 1 (on), 0 (off) or -1 (error)