# A.I. Claude to write code

**URL:** <https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577>\
**Category:** App Lab\
**Created:** [March 16, 2026, 8:13pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577 "2026-03-16T20:13:17Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom2020](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tom2020/32/1098783_2.png) [@tom2020](https://forum.arduino.cc/u/tom2020)\
**Post date:** [March 16, 2026, 8:13pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/1 "2026-03-16T20:13:17Z")

</div>

Yesterday I tried using the A.I. Claude

It took about two hours and lots of back and forforth, but Claude wrote a program for Arduino Uno Q AppLab that lets me control 8 of the output pins on the Uno Q by using a web page.

It generated the sketch.ino, main.py, index.htm, app.js ….

The webpage shows the status of the 8 pins and lets me turn them on and of.

Claude figured out the correct syntax for all the different functions. It was a lot better than using the A.I. in Google Chrome. Anybody else tried it?

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [March 16, 2026, 8:28pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/2 "2026-03-16T20:28:08Z")

</div>

Post all the code so we can see what it did.

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [March 16, 2026, 8:42pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/3 "2026-03-16T20:42:24Z")

</div>

What sort of "back and forth", and why two hours?

The main problem has been that beginners without the skills to recognize coding mistakes generally can't get useful results from the LLMs.

---

<div class="post-metadata">

**Author:** ![kenb4](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kenb4](https://forum.arduino.cc/u/kenb4)\
**Post date:** [March 16, 2026, 9:03pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/4 "2026-03-16T21:03:19Z")

</div>

> [@tom2020](#):
>
> It was a lot better than using the A.I. in Google Chrome.

I asked Google: "what is googles claude equivalent. is it different than the ai in chrome". Spoiler for the second half: yes.

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [March 17, 2026, 8:49am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/5 "2026-03-17T08:49:40Z")

</div>

> [@anon94801460](#):
>
> and why two hours?

yes - why?

it's probably much faster than this with the right prompting.

---

<div class="post-metadata">

**Author:** ![tom2020](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tom2020/32/1098783_2.png) [@tom2020](https://forum.arduino.cc/u/tom2020)\
**Post date:** [March 17, 2026, 6:48pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/7 "2026-03-17T18:48:58Z")

</div>

I

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/3/d/2/3d2334b56ae4abe45ad2759be0fae301d27e296d.png)

screen shot of the app. Claude A.I. wrote

copy of the app is attached.

It was an experiment for me. … to see what it could do. I was impressed. figured other people might be interested.

The reason it took quite awhile is my trying to figure out what Claude wanted…. it started to give pretty qood answers once i gave it a screen shot of the “About Arduino App Lab”. Then all the code it was generating got really good.

[forum8pins.zip](https://forum.arduino.cc/uploads/short-url/42FEzeR96wukBSRzNEC3tiC3RYc.zip) (21.6 KB)

---

<div class="post-metadata">

**Author:** ![meatmydesk](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@meatmydesk](https://forum.arduino.cc/u/meatmydesk)\
**Post date:** [May 16, 2026, 4:43pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/8 "2026-05-16T16:43:22Z")

</div>

I asked Claude if it could write VHDL for an fpga and it asked what kind of combinational or sequential , and other options i wanted. I said serial in, to 16bit, into a fifo with Pclk, Hsync,Vsync. and it wrote the code and asked what core i used, i said tang nano and it aksed which pinout as it could make me a .cst file for pin matrixing. Wild times. Mentioning specific signal and net names in the required design is critical info. I wonder if i missed out Vsync it would add it anyway.

---

<div class="post-metadata">

**Author:** ![milanriha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/milanriha/32/1098606_2.png) [@milanriha](https://forum.arduino.cc/u/milanriha)\
**Post date:** [May 27, 2026, 7:55am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/9 "2026-05-27T07:55:26Z")

</div>

Hi, I'm using Claude Code, but with little bit different chain. Visual Studio Code with Remote and Claude Code plugin. In this setup Visual Studio Code is running on personal computer, but agent run directly on Arduino, can write code, interact with filesystem or run commands. Claude coding results looks like this:

 ![battery](https://europe1.discourse-cdn.com/arduino/original/4X/f/5/3/f53a4c6259a9faa834468655e8cbea21d21bb1b9.png)

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [May 27, 2026, 8:01am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/10 "2026-05-27T08:01:09Z")

</div>

> [@tom2020](#):
>
> copy of the app is attached.

I have imported your app into my App Lab and run it successfully; it is working well. Some improvements are needed to make it more graphical, such as replacing 1/0 with an LED or bulb ON/OFF indicator similar `Blink LED with UI` app example of App Lab. Thank you for sharing your work.

However, if we use AI in this way to develop applications, then when will we be able to observe the mistakes that a human would normally make, or engage in discussion and challenge incorrect assumptions?

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [May 27, 2026, 8:04am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/11 "2026-05-27T08:04:19Z")

</div>

Thanks for sharing your approach @milanriha!

> [@milanriha](#):
>
> agent run directly on Arduino

Is the agent running on an **UNO Q** board?

Are you using an existing solution for the on-board agent part of your system, or is it something you created from scratch? Which model are you running on the board?

---

<div class="post-metadata">

**Author:** ![milanriha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/milanriha/32/1098606_2.png) [@milanriha](https://forum.arduino.cc/u/milanriha)\
**Post date:** [May 27, 2026, 8:07am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/12 "2026-05-27T08:07:38Z")

</div>

yes, it is. Probably this process

arduino 2246821 2244608 3 07:12 ? 00:01:37 /home/arduino/.vscode-server/extensions/anthropic.claude-code-2.1.145-linux-arm64/resources/native-binary/claude --output-format

---

<div class="post-metadata">

**Author:** ![milanriha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/milanriha/32/1098606_2.png) [@milanriha](https://forum.arduino.cc/u/milanriha)\
**Post date:** [May 27, 2026, 8:15am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/13 "2026-05-27T08:15:09Z")

</div>

Nothing custom, just install Claude Code plugin and Remote plugin.

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/6/7/2/672ac1f4ac41bc1143e5cefbe753602ddbe8b9be.png)

 ![gui](https://europe1.discourse-cdn.com/arduino/original/4X/b/9/0/b908f1a281cd5fb5e55ffb37776a0e1cc9d9b47d.jpeg)

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [May 27, 2026, 8:36am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/14 "2026-05-27T08:36:37Z")

</div>

> [@tom2020](#):
>
> It generated the sketch.ino, main.py, index.htm, app.js ….

Which part of this app could you write? Don't you know how write program for MCU and MPU and excnage data between them?

For example, I could write the .py and .ino and for other sections of the app, I would take help of forum members or AI.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [May 27, 2026, 10:15am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/15 "2026-05-27T10:15:23Z")

</div>

@tom2020

I am giving below the source code for the .py and .ino files of your app. Interested readers my get involved, read it and debate if there are something that deos not match between the .py and .ino files, working principle, etc.

**Sketch.ino**

```arduino
#include "Arduino_RouterBridge.h"

#define NUM_BTNS 8
int pins[] = {4, 5, 6, 7, 8, 9, 11, 12};
int pinStates[] = {0, 0, 0, 0, 0, 0, 0, 0};

String read_buttons() {
  String payload = "{";
  for (int i = 0; i < NUM_BTNS; i++) {
    payload += "\"btn" + String(i + 1) + "\":" + String(pinStates[i]);
    if (i < NUM_BTNS - 1) payload += ",";
  }
  payload += "}";
  return payload;
}

void set_pin(String args) {
  int comma = args.indexOf(",");
  String btn = args.substring(0, comma);
  int val = args.substring(comma + 1).toInt();
  int idx = btn.substring(3).toInt() - 1;
  if (idx >= 0 && idx < NUM_BTNS) {
    digitalWrite(pins[idx], val);
    pinStates[idx] = val;
  }
}

bool linux_started() { return true; }

void setup() {
  Bridge.begin();
  for (int i = 0; i < NUM_BTNS; i++) {
    pinMode(pins[i], OUTPUT);
    digitalWrite(pins[i], LOW);
  }
  Bridge.provide("set_pin", set_pin);
  Bridge.provide("linux_started", linux_started);
  bool started = false;
  while (!started) {
    Bridge.call("linux_started").result(started);
  }
}

void loop() {
  Bridge.notify("payload", read_buttons());
  delay(500);
}

```

**main.py**

```arduino
from arduino.app_utils import App, Bridge
from arduino.app_bricks.web_ui import WebUI
import time
import threading
import json
import os

ui = WebUI()

def pin_callback(data):
    print("pins:", data)
    ui.send_message("payload", data)

def set_pin_handler(client_id, data):
    pin_key = data.get("pin")
    val = int(data.get("value", 0))
    print("set_pin:", pin_key, "->", val)
    Bridge.call("set_pin", pin_key + "," + str(val))

def get_sysinfo():
    info = {}
    try:
        with open("/proc/stat") as f:
            a = f.readline().split()[1:]
        time.sleep(0.2)
        with open("/proc/stat") as f:
            b = f.readline().split()[1:]
        idle = int(b[3]) - int(a[3])
        total = sum(int(x) for x in b) - sum(int(x) for x in a)
        info["cpu"] = round(100.0 * (1 - idle/total), 1) if total else 0
    except:
        info["cpu"] = 0
    try:
        d = {}
        with open("/proc/meminfo") as f:
            for line in f:
                p = line.split()
                d[p[0].rstrip(":")] = int(p[1])
        total = d["MemTotal"]
        free = d.get("MemAvailable", d.get("MemFree", 0))
        used = total - free
        info["mem_pct"] = round(100.0 * used / total, 1)
        info["mem_used"] = round(used / 1024**2, 2)
        info["mem_total"] = round(total / 1024**2, 2)
    except:
        info["mem_pct"] = info["mem_used"] = info["mem_total"] = 0
    try:
        st = os.statvfs("/")
        total = st.f_blocks * st.f_frsize
        free = st.f_bavail * st.f_frsize
        used = total - free
        info["disk_pct"] = round(100.0 * used / total, 1)
        info["disk_used"] = round(used / 1024**3, 2)
        info["disk_total"] = round(total / 1024**3, 2)
    except:
        info["disk_pct"] = info["disk_used"] = info["disk_total"] = 0
    try:
        with open("/proc/uptime") as f:
            secs = float(f.readline().split()[0])
        h, r = divmod(int(secs), 3600)
        m, s = divmod(r, 60)
        info["uptime"] = "{:02d}:{:02d}:{:02d}".format(h, m, s)
    except:
        info["uptime"] = "00:00:00"
    return info

def sysinfo_loop():
    while True:
        try:
            ui.send_message("sysinfo", json.dumps(get_sysinfo()))
        except Exception as e:
            print("sysinfo error:", e)
        time.sleep(3)

ui.on_message("set_pin", set_pin_handler)
Bridge.provide("payload", pin_callback)

threading.Thread(target=sysinfo_loop, daemon=True).start()

App.run()

```

**Qustion-1:**  
If the purpose of the following code at the sketch side is to wait until the Linux has started, then there should be a correspondingg `Bridge.provide("linux_started", linuxStarted)` function in the python script; unfortunately, I can't trace it? Will you help to find it there?

```arduino
while (!started) {
    Bridge.call("linux_started").result(started);
  }

```

These are the code that I use for the above purpose.  
**At MCU side:**

```arduino
  String value = ""; //value is updated by Linux at MPU
  bool success = false;
  
  // Wait until Linux is started
  do
  {
      RpcCall rpc = Bridge.call("linux_started");
      success = rpc.result(value);
  }
  while(success != true); //true = 1 or false = 0, value = any value comes from MPU
  Monitor.println(value); //shows: Linux has booted...!

```

**At MPU side:**

```arduino
#used only for sync purposes
def linuxStarted():
  return "Linux has booted...!" # goes to MCU

Bridge.provide("linux_started", linuxStarted)

```

---

<div class="post-metadata">

**Author:** ![customcontroller](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/customcontroller/32/1013044_2.png) [@customcontroller](https://forum.arduino.cc/u/customcontroller)\
**Post date:** [May 27, 2026, 5:16pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/16 "2026-05-27T17:16:33Z")

</div>

The guy with the Swiss accent is out in front of everyone using Claude code for ESP32 development and testing.

[AI-Driven ESP32 Workflow (Spec → Code → Test) using Claude Code](https://www.youtube.com/watch?v=nmGEedloQ6E)

> After my last video, many of you asked for a deeper look at how I actually work  
> with AI and the ESP32. So today I will show you a real example project — an iOS  
> voice keyboard for any computer. But that’s only half of the story. You will  
> also see how I automatically test ESP32 devices using an “ESP32 workbench” — a  
> Raspberry Pi running special software that allows an AI agent to program,  
> flash, monitor, and even test Wi-Fi and BLE behavior of ESP32 boards. The  
> second part is a full walk-through, from the installation of Claude Code till  
> the test of the project, if you want to see the extreme power of today’s AI

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [August 30, 2026, 5:42pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/17 "2026-08-30T17:42:18Z")

</div>

Now that is somebody worth listening to. He has the experience to know if what an AI produces is valid or not. One of the big problems with inexperienced people using AI to write code is they have no idea if the code is any good. The fact it works is as my teachers used to say worth 1/10. The other 9/10 is using the right process and they have given that up to an AI.

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [August 30, 2026, 5:45pm UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/18 "2026-08-30T17:45:07Z")

</div>

> [@tom2020](#):
>
> Anybody else tried it?

Not me.

_(No AI was used in generating this post)_

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [August 31, 2026, 2:55am UTC](https://forum.arduino.cc/t/a-i-claude-to-write-code/1435577/19 "2026-08-31T02:55:56Z")

</div>

> [@jim-p](#):
>
> No AI was used in generating this post

Exactly what A-I would say. ( :

About the topic title:

What I do not understand is: Why the bragging about "Code I did not write"? It's like bringing home Dominoes and announcing to the family, "I made pizza!"

"Hey, look what I didn't do."  
"So."  
"How do I fix it?"

Looking forward to when this goes underground.
