WebUSB – Send String to 32u4

By Dan Chen, August 19, 2019

What you need

  • Hosting a local web server or https:// server
  • Adafruit Feather 32U4
  • Feather OLED Wing (I2C) Make sure you have the library and can run the “Adafruit SSD1306″example code https://github.com/adafruit/Adafruit_SSD1306
  • Chrome Browser

Ways to start a local server

The npm way:
npm i -g serve
serve
https://www.npmjs.com/package/serve

The Python 3 way:
python3 -m http.server –cgi 8080

Steps

  • Connect your 32u4 or Adafruit Feather 32u4 (At this point, you should have solder the OLED feather wing and include the OLED Adafruit library. Tip: test the display with the “Adafruit SSD1306” I2c example sketch)
  • Unpack the zip file and Upload sketch.ino via Arduino IDE for plateform.io
  • Point the URL to the examplefolder in your localhost.
  • The index.html page should load, and you should see the connect button at the top
  • Click connect, the Adafruit 32u4 show up in the menu, then click pair
  • Note: every time when you upload the sketch, be sure to disconnect or it will fight over the serial port
  • Type any text then press enter
  • Your text should show up on the OLED display