Robotics & Engineering Python
Advanced
60 mins
Teacher/Student led
+115 XP
What you need:
Chromebook/Laptop/PC
USB Cable
Raspberry Pi PICO W

Pico's First Blink

In this lesson, you'll create a simple program to make the onboard LED on your Raspberry Pi Pico blink using the Thonny editor and MicroPython language.
Learning Goals Learning Outcomes Teacher Notes

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Introduction

    In this lesson, we will create a simple project to make the onboard LED on your Raspberry Pi Pico blink. To begin, connect your Raspberry Pi Pico W to your computer using a micro USB cable.

    2 - Open Thonny

    Open the Thonny editor on your computer.


    3 - Select Interpreter

    An interpreter is a program that reads and executes code written in a programming language. We need to select the interpreter to ensure that Thonny understands and runs the code correctly for our specific hardware.

    In this case, we need to select 'MicroPython (Raspberry Pi Pico)' as the interpreter for the Raspberry Pi Pico W.

    4 - Create a New File

    Create a new file in Thonny and save it with the name 'blink.py'.

    5 - Import Libraries

    In this step, you will import the necessary libraries for your project. A library is a collection of pre-written code that you can use to perform specific tasks. By importing libraries, you can save time and effort, as you don't have to write the code from scratch.

    Type the following lines of code to import the necessary libraries:

    from machine import Pin
    import time
    from picozero import pico_led

    Here's what each library does:

    • machine: This library provides access to the hardware components of your Raspberry Pi Pico, such as the pins and the onboard LED.
    • time: This library allows you to add delays in your code, which you'll use to control the blinking speed of the LED.
    • picozero: This library contains functions specifically designed for the Raspberry Pi Pico, such as controlling the onboard LED.

    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more