Raspberry Pico Intro
Raspberry Pi Pico
a microcontroller development board,
RP2040
1
2
3
4> new microcontroller chip designed by Raspberry Pi in the UK.
- dual-core Arm Cortex-M0+
- 264KB RAM
- 16MB off-chip FlashMicro USB Port
1
2- provide power make Pico run
- USB port talk to picoBOOTSEL
1
- BOOTSEL is short for boot selection.
Raspberry Pico’s pins
Raspberry Pi Pico pins functions
… … … 3V3 3.3 volts power Pico 3.3V 从 VSYS 获取 VSYS ~2-5 volts power 连接Pico内部电源 VBUS 5 volts power 5V power taken from Pico’s micro USB port GND 0 volts ground 地 GPxx General-purpose input/output pin 通用GPIO口 GPxx_ADCx GPIO/ADC input 普通GPIO口或ADC输入口 ADC_VREF Analogue-to-digital coverter (ADC) voltage reference 模拟数字转换参考电压输入 AGND Anaglogue-to-digital coverter (ADC) 0 volts ground ADC输入电压参考0volts RUN Enable/disable Pico 启动/关闭Pico MicroPython - Hello, LED!
1
2
3
4
5
6
7
8
9import machine
import utime
# on-board LED is connected to one of RP2040's general-purpose input/output pins. GP25.
led_onboard = machine.Pin(25, machine.Pin.OUT)
while True:
led_onboard.toggle()
utime.sleep(1)
MicroPython on Raspberry Pi Pico
Installing MicroPython
1
2
3
4
5
6
7
8
9
10
11
12> MicroPython is a full implementation of the Python 3 Programming language that runs directly on embedded hardware like Raspberry Pi Pico.
# Hold BOOTSEL button down 3 seconds then let go
/Volumes/RPI-RP2
➜ tree
.
├── INDEX.HTM
└── INFO_UF2.TXT -- hold information about your Pico
0 directories, 2 files
# Darg-and-Drop MicroPython
- Drag and drop the MicroPython UF2 onto the RPI-RP2 volume, auto flash the firmware onto its internal storage.Programming with MicroPython
1
2
3
4
5
6
7
8> MicroPython is a Python-compatible programming language developed specifically for microcontrollers.
# Thonny - IDE
MicroPython v1.17 on 2021-09-02; Raspberry Pi Pico with RP2040
Type "help()" for more information.
print("Hello, World!")
Hello, World!
>>>
Rust on Raspberry Pi Pico
Getting Started with FreeRTOS on the Raspberry Pi Pico
RTOS - Real Time Operating System
Allows multiple tasks to execute “at the same time”
Schedules based on task priority
“Task Priority” allows the programmer to define what needs to happen first