1 | # node-enttec-open-dmx-usb 🔌
|
2 | > A Node.js library for interacting with the
|
3 | > [Enttec Open DMX USB Interface](https://www.enttec.co.uk/en/product/controls/dmx-usb-interfaces/open-dmx-usb/)
|
4 |
|
5 | Only tested on Windows, but as it uses `serialport` under the hood, it should also work in
|
6 | [these environments](https://serialport.io/docs/guide-platform-support#supported-platforms-and-architectures).
|
7 |
|
8 | ## Install
|
9 | ![npm](https://img.shields.io/npm/v/enttec-open-dmx-usb?style=flat-square)
|
10 |
|
11 | Minimum required Node.js version is `v14.0.0`.
|
12 |
|
13 | ```sh
|
14 | yarn add enttec-open-dmx-usb
|
15 | # or
|
16 | npm install enttec-open-dmx-usb
|
17 | ```
|
18 |
|
19 | ## Usage
|
20 | [**View documentation on jsdocs.io**](https://www.jsdocs.io/package/enttec-open-dmx-usb#EnttecOpenDMXUSBDevice)
|
21 |
|
22 | ```js
|
23 | import { EnttecOpenDMXUSBDevice as DMXDevice } from "enttec-open-dmx-usb";
|
24 |
|
25 | (async () => {
|
26 | const device = new DMXDevice(await DMXDevice.getFirstAvailableDevice())
|
27 |
|
28 | device.setChannels({
|
29 | 1: 0xFF,
|
30 | 2: 0x44
|
31 | })
|
32 |
|
33 | // same as
|
34 | device.setChannels([0xFF, 0x44])
|
35 |
|
36 | // same as
|
37 | device.setChannels(Buffer.from([0xFF, 0x44]))
|
38 | })()
|
39 | ```
|
40 |
|
41 | ## Events
|
42 | `ready` - `startSending` can be called.
|
43 |
|
44 | `error` - An error occurred.
|