This repository is a template for mechatronics development using Pi Pico. The repository is pre-configured for VSCode and has a Pi Pico project rep-configured, including servo library/examples and libraries for PiicoDev sensors. A folder of MicroPython firmware, including brick recovery firmware, is provided for easy access. A folder of basic PiicoDev sensor examples is provided with links to more examples. The main.py
has been preconfigured to be beginner friendly including debugging hints.
- Disconnect Pi Pico
- Hold Bootsel button
- Connect Pi Pico to USB
- Sideload the correct firmware to the RP1-RP2 drive that appears
- Ctrl + Shift + P or Command + Shift + P
- Select MicroPico: Connect
Note
Bootloaders for all MicroPython compatible controllers source here: https://micropython.org/download/
The Project folder is already configured and setup with the following features:
- All PiicoDev libraries are pre-installed
- A custom Servo library is pre-installed
- You can add other libraries to the project/lib folder
- You can create Python Scripts in the project/py_script folder and change the import parameter in project/main.py to run your script.
- Blink is loaded by default and several example versions of servo control have been added.
- V02-V05 demonstrates different ways to use the servo library, including different approaches to state engines and servo smoothing.
- Change the
file_name
variable in main.py to select which file in py_scripts you want to run.
- Right click the EXPLORER window and choose upload project to pico or Ctrl + Shift + P or Command + Shift + P and select MicroPico: Upload Project to Pico.
- If leaving Pico Pi connected to USB, you will need to manually run the
main.py
by right-clicking themain.py
file in the EXPLORER window and choosing Run current file on pico.
Important
Pin | Use | Reason |
---|---|---|
GP0 | TX | Used by Pi Pico for Serial communication and is often noisy |
GP1 | RX | Used by Pi Pico for Serial communication and is often noisy |
GP4 | Pull down input | Configured in main.py as a stop loop, ground the pin to stop the while True: loop |
GP11 | I2C SDA | Used by PiicoDev for I2C communication |
GP12 | I2C SCL | Used by PiicoDev for I2C communication |
- P1 Precision Temperature Sensor - example code
- P2 Atmospheric Sensor- example code
- P10 Colour sensor
- P13 RGB LED - Example Code
- P14 OLED - Example Code
- P26 3-Axis Accelerometer - example code
- P30 Ultrasonic Ranger - example code
TempeHS Pi Pico Boilerplate
by Ben Jones is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International