-
-
Save TimPietrusky/7e2d8b8fc04be3a17821cbc2b9395d10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (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