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
https://unjavascripter.github.io/web-serial-example/
- Upload the code in
./web_serial_onboard_led.ino
to your Arduino device Enable Chrome's Experimental Web Platform Features by visiting chrome://flags/#enable-experimental-web-platform-featuresNot required anymore, it has been shipped 🚀- Serve the web app code using the tool of your preference, or simply run
npx http-server
to see it live - Open the demo on your (Chromium based) browser
- Use the "Connect to serial port" button to open the Web Serial prompt and pick the right port
- Send a
1
to turn the LED on, or a0
to turn it off
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.