Skip to content

Latest commit

 

History

History
executable file
·
22 lines (14 loc) · 1.29 KB

README.md

File metadata and controls

executable file
·
22 lines (14 loc) · 1.29 KB

Web Serial API

A simple demo showing the basics of the Web Serial API connecting a browser with an Arduino.

Check this blog post on Web Serial API to learn more: https://dev.to/unjavascripter/the-amazing-powers-of-the-web-web-serial-api-3ilc

Live Demo

https://unjavascripter.github.io/web-serial-example/

TL;DR

  1. Upload the code in ./web_serial_onboard_led.ino to your Arduino device
  2. Enable Chrome's Experimental Web Platform Features by visiting chrome://flags/#enable-experimental-web-platform-features Not required anymore, it has been shipped 🚀
  3. Serve the web app code using the tool of your preference, or simply run npx http-server to see it live
  4. Open the demo on your (Chromium based) browser
  5. Use the "Connect to serial port" button to open the Web Serial prompt and pick the right port
  6. Send a 1 to turn the LED on, or a 0 to turn it off

Browser compatibility

So far only Chromium has shipped this API, so you can expect it to work on Chrome, Edge, and Opera. Check this table for the latest browser compatibility details.