Setup Your RP2040 Board: |
||
Topic |
Info |
(Click thumbnail to enlarge) |
Install your board's .UF2 bootloader file and CircuitPython libraries |
Here's our setup: - Programming language: CircuitPython (instead of MicroPython) - Microcontroller (uC) board: Raspberry Pi Pico (RPi Pico) with the new RP2040 chip - Programming editor: Mu - Operating System: PC with Win10
Watch this video to install Mu.
Your board's CircuitPython .UF2 file can be found at circuitPython.org. The .UF2 file contains a large number of modules or functions.
Libraries work in concert with the core modules/functions. An example of a library is the BME280 sensor for temperature, humidity, and barometric pressure. It is designed for a chip/board that is separate from your microcontroller (uC) board. CircuitPython libraries can be found at circuitPython.org/libraries.
Your board may not have a lot of flash storage space (2MB on RPi Pico) so only install the libraries (into your board's lib folder) that you currently need like: - simpleio.mpy - neopixel.mpy
Later you can add other libraries like: - adafruit_bus_device - adafruit_fancyled - adafruit_led_animation - adafruit_motor - adafruit_lis3dh.mpy - adafruit_thermistor.mpy |
(Note: the Thonny editor is an integrated development environment or IDE and is often used with MicroPython programming language and an RPi Pico but on a Raspberry Pi. We'll be using the Mu IDE instead)
|
Install the Mu editor |
Download Mu editor from https://codeWith.Mu and install it.
Use Mu to open the code.py file on your board's logical drive which could be G:, H:, etc. on your Win10 machine.
Download the Mu Editor User Cheat Sheet - CircuitPython Mode. |
|
Get a list of core modules/functions that are built into CircuitPython (CP) |
The CP .UF2 file for your board contains a large number of modules or functions. Within your programs, you import only the ones needed to run your program, e.g., import board or import time.
To see a complete list of CP's modules, type help("modules") in the REPL (lower window of Mu).
More info on modules: https://docs.python.org/3/tutorial/modules.html |
|
Get your board's pin inventory |
In the REPL window, type import board followed by dir(board).
To the right is an example of the pin inventory using the RPi Pico. |