filmov
tv
Programming a Raspberry Pi Pico in Python with Thonny on Windows 10

Показать описание
Starting from scratch, loading the MicroPython firmware onto a Raspberry Pi Pico microcontroller, and downloading & running a program. The program flashes the on-board LED, by outputting a 1 to pin 25 of the GPIO, waiting some milliseconds, then outputting a 0 and waiting again - in an infinite loop. Code at the bottom of this description.
Chapters:
0:01 Plugging in the Pi for firmware download
0:12 Start Thonny
0:15 Select Thonny user interface
0:22 Choose the MicroPython interpreter
0:30 Download the Python firmware
0:40 Open a source file
0:56 Run the program
1:05 Stop the program
1:10 Restart the program
1:17 Make a change & rerun
1:43 Finish session
1:52 Start again another time
2:03 Change the program & run again
Software: Windows 10, Python 3.10.4 with Thonny package.
Code:
# Program to flash the LED on a Raspberry Pi Pico.
# Requires the MicroPython (Raspberry Pi Pico) interpreter,
# e.g. in Thonny
# 26/5/22
import machine # Pi access functions
import utime # timer functions
# LED is on GP pin 25:
led_onboard = machine.Pin(25, machine.Pin.OUT)
while True: # loop forever
Videos on this channel are intended to support students work at the University of Westminster. They may or may not apply to your installation.
Chapters:
0:01 Plugging in the Pi for firmware download
0:12 Start Thonny
0:15 Select Thonny user interface
0:22 Choose the MicroPython interpreter
0:30 Download the Python firmware
0:40 Open a source file
0:56 Run the program
1:05 Stop the program
1:10 Restart the program
1:17 Make a change & rerun
1:43 Finish session
1:52 Start again another time
2:03 Change the program & run again
Software: Windows 10, Python 3.10.4 with Thonny package.
Code:
# Program to flash the LED on a Raspberry Pi Pico.
# Requires the MicroPython (Raspberry Pi Pico) interpreter,
# e.g. in Thonny
# 26/5/22
import machine # Pi access functions
import utime # timer functions
# LED is on GP pin 25:
led_onboard = machine.Pin(25, machine.Pin.OUT)
while True: # loop forever
Videos on this channel are intended to support students work at the University of Westminster. They may or may not apply to your installation.
Комментарии