Skip to content

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.

License

Notifications You must be signed in to change notification settings

TempeHS/TempeHS_Pi_Pico_Boilerplate

Repository files navigation

Learn MicroPython Raspberry Pi Pico

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.

Setup your Pi Pico and VSCode for development

How to Sideload Firmware to Hardware

  1. Disconnect Pi Pico
  2. Hold Bootsel button
  3. Connect Pi Pico to USB
  4. Sideload the correct firmware to the RP1-RP2 drive that appears
  5. Ctrl + Shift + P or Command + Shift + P
  6. Select MicroPico: Connect

Note

Bootloaders for all MicroPython compatible controllers source here: https://micropython.org/download/

Upload your project

The Project folder is already configured and setup with the following features:

  1. All PiicoDev libraries are pre-installed
  2. A custom Servo library is pre-installed
  3. You can add other libraries to the project/lib folder
  4. You can create Python Scripts in the project/py_script folder and change the import parameter in project/main.py to run your script.
  5. Blink is loaded by default and several example versions of servo control have been added.
  6. V02-V05 demonstrates different ways to use the servo library, including different approaches to state engines and servo smoothing.
  7. Change the file_name variable in main.py to select which file in py_scripts you want to run.

Steps to upload and run

  1. 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.
  2. If leaving Pico Pi connected to USB, you will need to manually run the main.py by right-clicking the main.py file in the EXPLORER window and choosing Run current file on pico.

Important

Reserved Pins

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

PiicoDev Components Available at Tempe High School

TempeHS Pi Pico Boilerplate by Ben Jones is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Languages