

When sending a 1 as a message the Arduino's onboard LED will light up, when sending 0 it'll turn off. The basic example uses a regular Arduino without any additional hardware. That's it! that's the basic setup of a Web Serial API handler. Here we can catch any reading error and do something with it. The expected baud rate values are:Įnter fullscreen mode Exit fullscreen mode

Here the baudRate needs to match the baud rate used by the device. We then open a port to connect with that device.

So dust off that Arduino you may have laying around, connect it to your computer and let's begin connecting the web and the physical world.Īfter validating if serial is supported by the browser, we use the requestPort method to prompt the user with a Browser provided UI displaying a list of available serial devices. Having access to physical devices will make it easier for people with web development knowledge to start diving into the waters of the IoT movement by interfacing with it through the browser, a familiar platform for them. Why not? This API brings one more capability to the more widespread platform, the web.
