QC

How to use OpenClaw on Arduino Uno Q

2 projects

Your Arduino UNO Q just got an AI brain - chat with it in simple English via Telegram, WhatsApp or Discord using OpenClaw

Devices and components

Arduino® UNO™ Q 4 GB

Software and tools

Arduino Applications Lab

Project description

Install OpenClaw on Arduino UNO Q

Create a custom Arduino skill

Log in to any email app

Control hardware with natural language

Python code

Python code on Linux side

1"""
2This Arduino UNO Q script was developed by newbiely.com
3This Arduino UNO Q script is made available for public use without any restriction
4For comprehensive instructions and wiring diagrams, please visit:
5https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-openclaw
6"""
7
8from arduino.app_utils import *
9from arduino.app_bricks.web_ui import WebUI
10
11
12def toggle_led():
13 result = Bridge.call("toggle_led", "")
14 print(f"OpenClaw -> toggle_led: {result}")
15 return {"result": result}
16
17
18def get_status():
19 result = Bridge.call("get_status", "")
20 print(f"OpenClaw -> get_status: {result}")
21 return {"result": result}
22
23
24web_ui = WebUI()
25web_ui.expose_api("GET", "/api/toggle_led", toggle_led)
26web_ui.expose_api("GET", "/api/get_status", get_status)
27App.run()

MCU code

Arduino code on MCU side

1/*
2 * This Arduino UNO Q code was developed by newbiely.com
3 *
4 * This Arduino UNO Q code is made available for public use without any restriction
5 *
6 * For comprehensive instructions and wiring diagrams, please visit:
7 * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-openclaw
8 */
9
10#include "Arduino_RouterBridge.h"
11
12// LED_BUILTIN is LED3 on the board, lights up RED, active LOW
13// LOW = ON, HIGH = OFF
14
15bool ledState = false;
16
17String toggle_led(String arg) {
18 ledState = !ledState;
19 digitalWrite(LED_BUILTIN, ledState ? LOW : HIGH);
20 String msg = ledState ? "LED is now ON" : "LED is now OFF";
21 Monitor.println(msg);
22 return msg;
23}
24
25String get_status(String arg) {
26 String status = "MCU is running. LED: " + String(ledState ? "ON" : "OFF");
27 Monitor.println("Status requested: " + status);
28 return status;
29}
30
31void setup() {
32 Monitor.begin();
33 Bridge.begin();
34 pinMode(LED_BUILTIN, OUTPUT);
35 digitalWrite(LED_BUILTIN, HIGH); // Start with LED off (active LOW)
36
37 Bridge.provide_safe("toggle_led", toggle_led);
38 Bridge.provide_safe("get_status", get_status);
39
40 Monitor.println("OpenClaw Bridge ready");
41}
42
43void loop() {
44}




Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.

Easy remote control

Remotely control an LED with ease. Devices and components Arduino Nano 33 BLE with headers Box 525 Resistors precision 1% - 17 values Breadb...