-
Connect the joystick module and button to your Raspberry Pi Pico:
- Connect the
GND
pin on the joystick module to aGND
pin on the Pico. - Connect the
VCC
pin on the joystick module to a3V3(OUT)
pin on the Pico. - Connect the
VRx
pin on the joystick module to an analog input pinGP26
on the Pico. - Connect the
VRy
pin on the joystick module to another analog input pinGP27
on the Pico. - Connect the
SW
pin on the joystick module to pinGP16
on the pico.
- Connect the
-
Install CircuitPython on your Raspberry Pi Pico:
- Download the latest version of CircuitPython for the Raspberry Pi Pico from the CircuitPython website.
- Connect your Raspberry Pi Pico to your computer using a micro USB cable while holding down the
BOOTSEL
button on the Pico. This will put the Pico in bootloader mode and it should appear as a USB drive namedRPI-RP2
. - Drag and drop the CircuitPython
.uf2
file that you downloaded earlier onto theRPI-RP2
drive. The Pico will automatically restart and install CircuitPython. - After installing CircuitPython, the Pico will appear as a USB drive named
CIRCUITPY
.
-
Install the
adafruit_hid
library on your Raspberry Pi Pico:- Download the latest version of the Adafruit CircuitPython Library Bundle from the CircuitPython website.
- Unzip the downloaded file and open the resulting folder.
- Locate the
adafruit_hid
folder inside thelib
folder. - Open the
CIRCUITPY
drive for your Raspberry Pi Pico and locate or create a folder namedlib
. - Copy the entire
adafruit_hid
folder from the unzipped Library Bundle into thelib
folder on your Raspberry Pi Pico.
-
Save the code to the pico with the same name
-
After saving this code to your Raspberry Pi Pico, it will automatically restart and run it.
Once you have completed these steps, you should be able to control the mouse on your PC using the joystick module connected to your Raspberry Pi Pico and use its button as a left mouse button