Skip to content

Instantly share code, notes, and snippets.

@TimPietrusky
Last active April 24, 2018 05:07
Show Gist options
  • Save TimPietrusky/7e2d8b8fc04be3a17821cbc2b9395d10 to your computer and use it in GitHub Desktop.
Save TimPietrusky/7e2d8b8fc04be3a17821cbc2b9395d10 to your computer and use it in GitHub Desktop.
// (a) Import the module
import Controller from 'webusb-dmx512-controller/controller.js'
// (b) Create an instance
const controller = new Controller()
// (c) Get a reference to the button
const activateButton = document.getElementById('activateWebUsb')
// (d) Listen for click events on the button
activateButton.addEventListener('click', e => {
// (e) Enable WebUSB and select the Arduino
controller.enable().then(() => {
// (f) Create a connection to the selected Arduino
controller.connect()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment