Hello Raspberry Pi Pico 2 (RP2350): first try MicroPython and CircuitPython
First try MicroPython/CircuitPython on Raspberry Pi Pico 2 (RP2350).
It's empty in fresh new Raspberry Pi Pico 2, it will power-up in Bootloader mode and RP2350 driver will appear as storage.
Download firmware:
MicroPython:
- Visit
https://micropython.org/download/RPI_PICO2/
to download MicroPython firmware for Pico2. Both normal RP2350 and
RP2350-RISCV version are available.
CircuitPython:
-
Visit
https://circuitpython.org/board/raspberry_pi_pico2/
to download CircuitPython firmware for Pico 2 by Raspberry Pi.
To
install MicroPython or CircuitPython firmware, simple drag the downloaded
firmware (.uf2) to RP2350 driver.
To enter Bootloader mode:
Using BOOTSEL button:
Push and hold the BOOTSEL
button as you plug your Pico 2 into your computer.
Using code:
If your Pico 2 have already been flashed MicroPython or CircuitPython,
you can make it reboot in Boot load mode using code.
In
MicroPython:
import machine
machine.bootloader()
In CircuitPython:
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
microcontroller.reset()
Test code in the video:hello_rp2_micropython.py
# Hello Raspberry Pi Pico 2 in MicroPython
import sys, os
from machine import Pin, Timer
print("=========================================================")
info = sys.implementation[0] + ' ' + os.uname()[3] + '\n' + \
'run on ' + os.uname()[4]
print(info)
print("=========================================================")
led = Pin(25, Pin.OUT)
timer = Timer()
def blink(timer):
led.toggle()
timer.init(freq=5.0, mode=Timer.PERIODIC, callback=blink)
hello_rp2_circuitpython.py
# Hello Raspberry Pi Pico 2 in CircuitPython
import sys, os
import time
import board
import digitalio
print("=========================================================")
info = sys.implementation[0] + ' ' + os.uname()[3] + '\n' + \
'run on ' + os.uname()[4]
print(info)
print("=========================================================")
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = True
time.sleep(0.25)
led.value = False
time.sleep(0.25)
next:
~ I2C OLED (SSD1306/SSD1315) screen with Raspberry Pi Pico 2 (RP2350) using MicroPython
~ Raspberry Pi Pico 2/MicroPython display on SPI SSD1306 OLED
~ Raspberry Pi Pico 2 (RP2350)/MicroPython display on two OLED, SSD1306 I2C and SPI.
Comments
Post a Comment