Thonny allows you to write Python code, save it on your Pico and run it. This guide will show you how to use it with MicroPython
Download Thonny from here and install it on your computer.
Turn on the option to view files:
Plug your Pico into your computer’s USB.
At the bottom right select the MicroPython option:
You should see that there are no files currently on your Pico:
Create a new file by right-clicking in the files area:
Name the file hello.py:
Enter the following code:
Run the code by pressing the play button:
You should see the result appear:
Note that this code is running on the Pico, not your computer!
The Pico has an LED that you can flash with some code.
Create a new file called blink.py and enter the following code:
# Blink the built-in LED
from machine import Pin
from time import sleep
led = Pin("LED", Pin.OUT)
for i in range(10):
led.on()
sleep(1)
led.off()
sleep(1)
Run this code. The LED should flash 10 times.