--- name: bridge description: Arduino Bridge — the RPC layer that lets Python on the Uno Q's Linux side (MPU) call functions on the Arduino sketch (MCU) and vice-versa. Load this before any project that combines a Python program with an Arduino sketch, or asks how to send data between the Linux side and the sketch. --- # Bridge — Inter-Processor RPC on the Uno Q The Uno Q is two computers on one board: - **MPU** (QRB2210, Debian Linux) — Python, web servers, AI models, OpenCV, Wi-Fi. - **MCU** (STM32U585, Zephyr + Arduino) — `.ino` sketches; owns every Arduino header pin (digital, PWM, ADC, I²C, SPI, UART, CAN). **Bridge** is Arduino's software RPC layer so either side can call the other. The MCU has **no Wi-Fi and no Linux**; the MPU has **no direct Arduino pins**. Use Bridge whenever a project needs *both* sides. ## When to use Bridge | Scenario | Why | |---|---| | Python reads a sensor wired to A0 | MCU owns the pin → Python calls the MCU | | Sketch needs internet/weather data | MCU has no Wi-Fi → MCU calls the MPU | | An AI model on Linux drives an LED | Python runs the model → calls the MCU | | Sketch streams data to a web dashboard | MCU samples → MPU serves HTTP/WebSocket | ## Two ways to reach the MCU from ZeroClaw 1. **Runtime GPIO via the deployed Bridge app** — use the `gpio_read` / `gpio_write` tools. These talk to the uno-q-bridge app (TCP :9999) that must already be running on the board (`zeroclaw peripheral setup-uno-q` deploys it). Good for toggling pins on a sketch that is already flashed. 2. **Flash a whole sketch** — use `uno_q_flash` (see the `flashing` skill) to compile and program a full `.ino`, including one that `#include ` and exposes its own RPC services. ## Sketch side (MCU) ```cpp #include void setup() { Bridge.begin(); } void loop() { /* expose services / handle calls */ } ``` ## Pitfalls - The MCU has **no Wi-Fi peripheral** — `#include ` will not compile for `arduino:zephyr:unoq`. Network access is the MPU's job, reached via Bridge. - `gpio_read`/`gpio_write` require the bridge app running; if they error with a connection failure, the app isn't up.