Developing the code for our IoT joystick
We will install CircuitPython on our Raspberry Pi Pico WH and use Thonny for development. Our Pico WH code will consist of two files, one to encapsulate the joystick functionalities and the other to transmit MQTT messages.
We will start by setting up our Raspberry Pi Pico WH for development.
Setting up our Raspberry Pi Pico WH
For our IoT joystick, we will install CircuitPython and use the Adafruit MiniMQTT library. We could just as easily use MicroPython and the micropython-umqtt.simple
package. However, using CircuitPython for the Raspberry Pi Pico WH in our IoT joystick application offers more stable and well-maintained libraries compared to MicroPython.
To install CircuitPython on our Raspberry Pi Pico WH, we do the following same steps as we did in Chapter 9:
- If Thonny is not available on our operating system, we visit the Thonny website and download an appropriate version (https://thonny.org).
- We then launch Thonny...