Skip to content
Snippets Groups Projects
Simon von Schmude's avatar
8593973d

p5js Webserial to Arduino

Working example using a Web-Serial Library. There are a few other webserial libraries available, but this appears to be the easiest to implement, as its setup only requires one line in the index.html and one in the .js function setup().

--> build and tested with arduino IDE v2.1 and Processing IDE v4.2 (processing Mode: p5.js v1.6)

Things to Note

  1. Currently, the setup lines break when using the auto-formatting function in Processing, consider using VSCode.
  2. All functions need to be async functions in order to work.
  3. keep in mind that only once program can use a Serial port at a time. This means that you can't open the Arduino Serial monitor when connected to web-serial.
  4. Webserial currently only works in Chrome.
  5. Sometimes, the browser cache ignores changes to your script.To avoid this, use incognito mode.

Further information