Using ChatGPT to control LEDs

Iestyn Lloyd
Mar 7, 2023

--

Following up on yesterday’s noodling about getting voice > voice using ChatGPT working, I thought I’d try hooking it up to a real life object. In this case a Cosmic Unicorn from Pimoroni.

Take a look:

This is super easy using Python. It’s unreal!

I’m using a system message for ChatGPT to set the behaviour for the assistant:

{"role": "system", "content": """
Convert this text to a programmatic command, and add a short confirmation message:
Example: Make the LEDs red
Output: {'target':'LEDs','result':{'r':255,'g':0,'b':0},'message':'OK, I made the LEDs red'}
"""
}

Should be pretty easy to adapt this for more controls..

Let me know if you’d like me to share the code!

--

--