R2D2 Program

Dynamic Logic Lights

Micropython code

For the code below to work you need to have already set up a MQTT broker on a computer. I have one running on a raspberry pi. And you will need to add the 4 python scripts below to your pico's

Just download them. Open in Thonny and save to your pico

Edit the "secrets.py" - change the SID and password to your own and save it again


The code below needs to be saved to your pico as main.py. Just click the link below to download it.
The pico runs the main.py at boot

To get the MQTT client working on the pico, you will need to first import upip via Thonny and then using Thonnys command prompt type
import upip
upip.install("umqtt.simple")

This installs the mqtt library to your pico which the code needs to work. 

To run a test from broker type      mosquitto_pub -h localhost -t "logicone" -m "Test Message"

Follow Us


No Code Website Builder