diff --git a/README.md b/README.md index 2130199..9d23fbe 100644 --- a/README.md +++ b/README.md @@ -112,8 +112,36 @@ Ubuntu: `sudo apt install Thonny` +Raspbian: + +If you are using a Raspberry Pi, Thonny should already be installed. (You will be limited to Python 3.9 but this should not cause any problems) + Once completed you should be able to connect to the RP2040 with Thonny. +In the bottom-right corner of the software you will see the currently configured Python interpreter. Click on that to edit it. + +You will be taken to options, where you can find "MicroPython for Rpi Pico". When you select this option, the code your write in Thonny will be executed on the Pico board rather than locally. You're programming the board! + +In the "rp2040_client" folder you will find a folder "lib". Inside of that you will find the folder "mqtt", and a python file called `simple.py` + +The lib folder is important. It is where the pico will look for any libraries you have installed on the board. You will need to move the lib folder onto the Pico using Thonny. The easiest way to do this save-as. Create a new file, and save it into "lib/mqtt" as `simple.py`. You can then just copy the code into that file. + +You are now ready to write the code that will use the MQTT client. Take a look in the `main.py` for an example. + +The example uses the MQTT client to subscribe to the "godot" topic. Note that you will need to edit the code to fill in the details about your wifi network. + +## The Godot Example + +Once you have the MQTT client subscribed on the Pico board, you could consider another interesting use of MQTT. + +In the `godot_client` folder you will find a Godot project you can import into the game engine to test your MQTT connection. + +Like the project we put on the Pico board, there is a lightweight client that connects when you run the application. + +If both the Godot client and the Pico client are connected to the same broker on the same network, you should be able to send messages between them. + +This opens up a whole world of possibilities! + ## Resources * Mosquitto man pages https://mosquitto.org/man/