ArduinoSerial Op
Simlple way to communicated with Arduino Boards using Serial
Simlple way to communicated with Arduino Boards using Serial
Summary (oneliner)
Web Serial JSON Bridge (cables.gl Op)
A lightweight, real-time serial bridge between cables.gl and microcontrollers (Arduino, ESP32, Raspberry Pi Pico) using the Web Serial API. Communication operates via newline-delimited JSON packets (\n) at a fixed 115200 bps baud rate.
Tailored for workshops, rapid prototyping, and small creative coding projects, this Op favors instant setup over extensive configuration. For simplicity and ease of use in teaching contexts, event-driven digital input handling (debouncing, state changes, internal pull-ups) is deliberately omitted, focusing solely on continuous analog telemetry and direct output control.
A ready-to-use Arduino example sketch is provided as a .zip archive, featuring full servo motor integration alongside standard I/O routines.
Data Protocol
The Op exchanges flat JSON objects between cables.gl and the firmware.
Outputs (cables.gl → Microcontroller)
All outgoing numeric values are rounded to integers and filtered by an anti-spam check to prevent sending duplicate serial frames.
Digital*→ Maps todigitalWrite()functions (e.g.,{"Digital1": 1}, relays, LEDs).PWM*→ Maps to Pulse Width Modulation outputs (e.g.,{"PWM1": 180}, LED dimming, motor speed).SERVO*→ Maps to servo motor position commands (e.g.,{"SERVO1": 90}).
Inputs (Microcontroller → cables.gl)
Incoming serial lines are parsed as JSON objects and forwarded to the Received Object output port.
Analog*→ Maps to continuousanalogRead()telemetry (e.g.,{"Analog0": 512, "Analog1": 1023}, sensors, potentiometers).
- Ops.Patch.P8FFfwy.ArduinoSerial
- Patch Op - visible in this patch only
- MIT
Documentation (markdown)
Issues
Example patch id
Youtube ids (comma seperated)
Op Licence
Caniuse query
Arduino Serial - Example
This cables.gl Op provides a lightweight, plug-and-play Web Serial bridge designed for workshops and rapid prototyping, exchanging JSON data at 115200 bps to control servos, PWM, and digital outputs while streaming analog inputs, complete with an included Arduino example sketch in a .zip archive.
INPUT PORTS
The JavaScript object to stringify and stream over serial.
Opens the browser's native serial device selection dialog.
Closes the active port and releases reader/writer streams.
Revokes persistent device permissions stored in the browser, resetting the port list.
When true, automatically reconnects on load to the first previously authorized device without showing a prompt.
OUTPUT PORTS
Parsed JSON received from the microcontroller.
Connection status (true when active).
Counter of valid parsed incoming frames.
Flag set to true when a connection or I/O failure occurs.
Indicates whether the client browser supports the Web Serial API.
Detailed description of the latest error.