2026-05-24
I added a "feedback orb" to Guess Hue. It lights up according to the current color the player has pressed, and resets before each new prompt.

This wasn't easy. Mostly because I didn't know how to do it and there aren't exactly a bunch of tutorials on it. Oh, there are lots of examples out there for sending data from a microcontroller to your game, but I needed the information to flow the other direction, from the game back to the controller. I did eventually figure out something that worked. It feels like a terrible pile of hacks, but it works.
You will need:
- A Godot game
- An Arduino-compatible microcontroller
- Some Neopixels
- A cheap LED lamp I had lying around (the orb)
- A computer with Python and Pyserial installed, on which to run your game
Design: decide what light effects you want (ie, "solid cyan" or "blink amber") for what triggering events (player pushes a certain button, opens a treasure chest, dies, etc). Assign each one to a key code (A, LEFT_ARROW, etc).
Code: Write a little Python script that takes a character as an argument (parameter? I can never remember when it's an argument and when it's a parameter) and just sends that character over the serial port. Does this script HAVE to be Python? Probably not, but with the Pyserial library it was trivial. I was using a Windows machine, I'm not sure how this translates to other OSes.
Godot: Add that little script to your project. If you want to get fancy, add a dictionary for all your effects/characters. When the triggering event happens, use OS.execute to call the script with the appropriate character. I don't remember running into permissions issues with this, which is honestly a bit concerning.
Arduino: Connect your Neopixels to this board and add code for all your desired lighting effects. This is the part you can find lots of example code for. In the loop, read from serial. Write a big ole if-else block to take the results of that read and call the appropriate lighting effect.
Setup: I did not have time to do this nicely. The Neopixel wires extend out the back of the buttons. (You can see in the image above how the wires are just taped to the tablecloth. If it had been my tablecloth, I would have run the wires under it; I couldn't poke holes through someone else's tablecloth!) I literally just took the lamp part out of the orb lamp and set the orb part on top of the Neopixel board. I'm kind of blown away by how bright it was.
For my particular game, I actually only needed Godot to communicate to the Arduino when it was time to reset the lights.
#send_f.py
import serial
com_port = "COM6" # or whichever port you're plugged into
baud_rate = 9600 # same as you call in the Arduino's Serial.begin(9600)
byte_to_send = b'F' # Why did I pick 'F'? Who even knows.
try:
with serial.Serial(com_port, baud_rate, timeout=1) as ser:
ser.write(byte_to_send)
print("F")
except serial.SerialException as e:
print(f"Serial error: {e}")
#GDScript
func send_f_byte():
var python_executable = "python" #if this doesn't work you may have to specify the full path to python.exe?
var script_path = ProjectSettings.globalize_path("res://assets/send_f.py")
var output = []
var exit_code = OS.execute(python_executable, [script_path], output, false, false)
# debugging
if exit_code == 0:
print("Python script ran successfully:", output)
else:
push_error("Python script failed with output: " + str(output))
I'm kind of embarrassed it's so simple.
If you want to see my Arduino code, it's on my GitHub. Feel free to use any of this in your own projects, but if you do, please let me know! I'd love to see what you've made.
Some troubleshooting tips:
- You can test/debug the Arduino code in the Arduino IDE. The Serial Monitor can send to the controller! Maybe this is a really obvious thing that everyone already knows, but hey, I didn't know about it before now.
- However, be cuser to close the Arduino IDE before running your game, it won't be able to access the serial port if the IDE is using it.
- If you haven't worked much with Arduinos before, SAVE YOUR SKETCH. Like, put it in a repo. There's no way to pull the code back off the device, so if you want to modify it later, you'll have to have the code stored somewhere else.
- Both your dev machine and your game machine need to have Python and Pyserial installed.
- In Windows, the Device Manager will show you under Ports (COM and LPT) which port your Arduino is connected to. If it doesn't match what's in the script, you can remap it under properties > port settings > advanced > COM Port Number, but this could cause issues if something else was using that port.