Files
blog-code/godot-arduino-1-led-first-light
tyler parker bb1d70c620 Godot + Arduino series: companion project code
Self-contained project code for the "Godot Isn't Just for Games" series:
Arduino sketches, the Python serial<->UDP bridge, and the Godot 4 projects,
one folder per article.
2026-08-09 21:14:55 +00:00
..

Part 1 — Your First Arduino Round-Trip

Code for "Godot Isn't Just for Games: Your First Arduino Round-Trip".

A button in a Godot 4 scene reaches down a USB cable — through a Python-to-UDP bridge — and lights a real LED on an Arduino Uno.

Contents

arduino/
  LedBasics/LedBasics.ino   # reads L1/L0 off serial, drives the LED on D13
  bridge/bridge.py          # serial <-> UDP relay (run this, leave it running)
  bridge/ledtest.py         # quick standalone LED blink test (no Godot)
godot/
  ArduinoGodot/             # Godot 4 project: one styled toggle button

Wiring

D13 → 220 Ω resistor → LED long leg (anode); LED short leg (cathode) → GND. No breadboard? The Uno's onboard LED is already on D13.

Run it

  1. Flash arduino/LedBasics/LedBasics.ino to the Uno (Arduino IDE, 115200 baud).
  2. Bridge: pip install pyserial, then python arduino/bridge/bridge.py. Leave it running.
  3. Godot: open godot/ArduinoGodot/ in Godot 4, press Play, click the button.

The bridge auto-detects the board and reconnects if the cable pops out.