1
0
Fork 0
mirror of https://github.com/moritzruth/node-enttec-open-dmx-usb.git synced 2025-06-17 09:44:18 +00:00

No longer use @pika/pack and remove some events

This commit is contained in:
Moritz Ruth 2021-02-26 10:40:18 +01:00
parent 8c0eefb9a4
commit dc0e83c14c
No known key found for this signature in database
GPG key ID: AFD57E23E753841B
8 changed files with 141 additions and 2739 deletions

View file

@ -1,9 +1,16 @@
# node-enttec-open-dmx-usb
# node-enttec-open-dmx-usb 🔌
> A Node.js library for interacting with the
> [Enttec Open DMX USB Interface](https://www.enttec.co.uk/en/product/controls/dmx-usb-interfaces/open-dmx-usb/)
## Installation
```shell script
Only tested on Windows, but as it uses `serialport` under the hood, it should also work in
[these environments](https://serialport.io/docs/guide-platform-support#supported-platforms-and-architectures).
## Install
![npm](https://img.shields.io/npm/v/enttec-open-dmx-usb?style=flat-square)
Minimum required Node.js version is `v14.0.0`.
```sh
yarn add enttec-open-dmx-usb
# or
npm install enttec-open-dmx-usb
@ -12,23 +19,26 @@ npm install enttec-open-dmx-usb
## Usage
[**View documentation on jsdocs.io**](https://www.jsdocs.io/package/enttec-open-dmx-usb#EnttecOpenDMXUSBDevice)
All functions are documented and the code is easy to understand, so feel free to [explore it](src/index.ts).
```js
import { EnttecOpenDMXUSBDevice as DMXDevice } from "enttec-open-dmx-usb";
(async () => {
const device = new DMXDevice(await DMXDevice.getFirstAvailableDevice());
const device = new DMXDevice(await DMXDevice.getFirstAvailableDevice())
device.setChannels({
1: 0xFF,
2: 0x44
});
})
// same as
device.setChannels([0xFF, 0x44]);
device.setChannels([0xFF, 0x44])
// same as
device.setChannels(Buffer.from([0xFF, 0x44]));
})();
device.setChannels(Buffer.from([0xFF, 0x44]))
})()
```
## Events
`ready` - `startSending` can be called.
`error` - An error occurred.