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.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
# Part 1 — Your First Arduino Round-Trip
|
||||
|
||||
Code for [*"Godot Isn't Just for Games: Your First Arduino Round-Trip"*](https://codebycandle.com/blog/godot-arduino-led-first-light).
|
||||
|
||||
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.
|
||||
Reference in New Issue
Block a user