Get Started at Pico
If you are the first time o use the Pico, you need to first learn how to get started at the Pico before you run other examples.
The Pico supports C and the Micropython which requires different firmware.
In most of the examples archives (Demo codes), we provide a Micropython firmware (uf2 file), we recommend you to use the provided firmware to test the board. Because the codes may run abnormally with different firmware.
If the board is tested to be workable, you can also download the newest firmware from Raspberry Pi and do further programming.
- If you want to use C codes, please refer to the C/C++ Guides
- If you want to use Micropython codes, please refer to the Micropython Guides.
- The link of the newest Micropython firmware of Pico
- Official Guides of Raspberry Pi Pico
Use the Raspberry Pi as the host device. Open a terminal and run the following commands to download the example.
sudo apt-get install p7zip-full
sudo wget https://www.waveshare.com/w/upload/b/b6/Tilt-Sensor-code.7z
7z x Tilt-Sensor-code.7z -o./Tilt-Sensor-code
- Note that if the path of your SDK is different, you need to modify the command and use the correct path to export
- Generate Makefile and build
- After building, a uf2 file is generated
- Press and hold the button of Pico, connect it to Raspberry Pi then release the button.
- Copy/Drag the uf2 file to the protable disk (RPI-RP2) recognized
cp main.uf2 /media/pi/RPI-RP2/
- Flash the Micropython firmware first
- Open the Thonny IDE (Menu->Programming->Thonny Python IDE).
- 【Optiional】If the Thonny IDE in the Raspberry Pi is not the new version which supports Pico, please upgrade it first.
sudo apt upgrade thonny
- Configure Interpreter, choose Tools->Options... -> Interpreter, choose MicroPython(Raspberry Pi Pico) and the ttyACM0 port.
- Click File -> Open.. and browser the micropython codes (Tilt Sensor.py) to run the codes
- When the module is shaken or tilted, the signal indicator on the module is on, and when the module is placed in parallel, the signal indicator on the module is off.
The STM32 examples are based on the STM32F103RBT6 and the STM32H743. The connection provided below is based on the STM32F103RB. If you need to use other STM32 boards, you may need to change the hardware connection and port the code yourself.
|| Power input
|| Power ground
|| Digital output
The examples are developed based on the HAL libraries. Download the Demo codes archive to your PC. Unzip and find the STM32 project from Tilt-Sensor-code\STM32\STM32F103RB\MDK-ARM.
- Open the Tilt Sensor.uvprojx file by Keil
- Build and the project
- Program the project to your STM32 board.
- Connect the UART1 of your STM32 board to the PC and check the serial data by SSCOM software.