npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

webusb-dmx512-controller

v1.0.7

Published

Manage a DMX512 universe with an Arduino-based controller directly from the browser by leveraging WebUSB.

Downloads

36

Readme

WebUSB DMX512 Controller

1.0.0

Manage a DMX512 universe with an Arduino-based controller directly from the browser by leveraging WebUSB.

👉 To fully understand the background of this module you should read the article How to build a WebUSB DMX512 Controller by using an Arduino. 👈

Table of Contents


ES6 module

The module can be used in projects where you want to control a DMX512 controller over WebUSB. It's written in JavaScript and contains only one Class called Controller.

Install

Install the webusb-dmx512-controller module into your project:

npm install webusb-dmx512-controller

API Documentation

Can be found on API documentation.

Usage

import Controller from 'webusb-dmx512-controller/controller.js'

const controller = new Controller()
const activateButton = document.getElementById('activateWebUsb')

// Listen for click events on the activate button, because
// `controller.enable` must be triggered by a user gesture
activateButton.addEventListener('click', e => {

  // Enable WebUSB and select the Arduino
  controller.enable().then(() => {

    // Create a connection to the selected Arduino
    controller.connect().then(() => {

      // Update the 1 channel of the DMX512 universe with value 255
      controller.updateUniverse(1, 255)
    })
  })
})

Also make sure to take a look the code behind the demo to get more usage examples.

The module is also used in luminave in it's usb-dmx-manager component.

Browser Support

In order to use the module you have to use a browser that supports WebUSB:

  • Chrome 61 + 62: Behind flags
    • chrome://flags/#enable-experimental-web-platform-features
  • Chrome 63+: Native support

Demo

In order to test the WebUSB DMX512 Controller directly in the browser you can use the demo on GitHub. The code behind the demo can be found in the repository.

Run locally

  • Clone this repository
  • Install the dev dependencies by executing npm install inside the repository
  • Execute npm start to start the local web server
  • Open the demo on localhost:8080

Build your own controller

Check out the article "How to build a WebUSB DMX512 Controller by using an Arduino" as it provides a detailed explanation on how to use the content of this repository to build your own WebUSB DMX512 Controller:

Arduino Leonardo with DMX512 shield attached

Hardware