/web-serial-api

Web Serial API examples – talk to serial devices from your browser.

Primary LanguageHTML

Web Serial API Examples

The Web Serial API makes it possible for web browsers to read and write from serial devices. Soon you can chat with Arduinos, Raspberry Pis and most any device that speaks serial – straight from your website and no drivers needed. The Serial API specification is, as of this writing, not a W3C standard but you can already play with it in the latest beta versions of Chrome and Edge.

This repository is my playground for evaluating this upcoming API. If you possess an Arduino, you can play along too.

Reading analog input, using a potentiometer, and dimming an LED from the browser.

Before Playing With the Serial API

Make sure you have the following to play along at home:

  1. Arduino compatible device and USB cable
  2. Arduino IDE
  3. Beta version of Chrome or Edge
  4. Experimental Web Platform features enabled

After installing your browser of choice, launch it, and enable the Experimental Web Platform features flag.

Serial API Examples

The course of action is the same for toying with all examples. Load one of the includes examples on your device using the Arduino IDE, build the associated circuit, and then point your browser to the example you want to explore.

Analog Read Serial

Open the built-in example sketch 01.Basics → AnalogReadSerial in the Arduino IDE and upload it to your device. Follow the tutorial to connect a potentiometer to the Arduino. Make sure your circuit works by using the Serial Monitor.

Visit my Analog Read Serial example page.

Dimmer

Open the built-in example sketch 04.Communication → Dimmer in the Arduino IDE and upload it to your device. Follow the tutorial to connect an LED to the Arduino. Make sure your circuit works by using the Serial Monitor.

Visit my Dimmer example page.