Interfacing with Micropython on the Raspberry Pi Pico#

Raspberry Pi Pico#

Comaptible Hardware#

Development Environments#

There are two Micropython development environments that are particularly useful with the Raspberry Pi Pico.

Thonny IDE#

The Thonny IDE is the most widely used IDE for Micropython and should be part of any installation. It is mature, fully supported, and does nice things like setting the real time clock on reboots.

Jupyter notebooks#

Jupyter notebooks are an excellent means of combining narrative, code, and results in a single document. Jupyter kernals for Micropython are being developed by a number of users on github, but not yet in a mature state.

Activity#

  1. If you haven’t already done so, install the Anaconda distribution of Python on your laptop.

  2. Install the Jupyter Micropython kernal on your laptop.

  3. Attach your Raspberry Pi Pico, then test your kernal by running the following two code cells. Be sure to specify the MicroPython-USB kernal.

%serialconnect
Found serial ports: /dev/cu.usbmodem143101, /dev/cu.BLTH, /dev/cu.Bluetooth-Incoming-Port 
Connecting to --port=/dev/cu.usbmodem143101 --baud=115200 
Ready.

import machine
import time

led = machine.Pin(25, machine.Pin.OUT)
start = time.time()
while time.time() - start <= 20:
    led.toggle()
    time.sleep_ms(500)
....