MicroPython on the Pico lesson plan
Real Python on a Raspberry Pi Pico: blink and the REPL, buttons and if, loops and PWM, a knob on the ADC, lists and functions on an LED bar, an OLED on I2C, and a reaction game boss.
Objectives and materials
By the end, students can
- Blink two LEDs, type Python live into the board, and make choices with if.
- Fade with a for loop and PWM, and read a knob with the ADC.
- Lists and functions on an LED bar, and text on an OLED over I2C.
- A reaction timer with a random wait, a cheat catcher and a best score.
Materials for the whole unit
- Full-size breadboard
- LED x 6
- OLED display, 128x64
- Potentiometer
- Pressure, humidity and temperature, BME280
- Pushbutton
- Raspberry Pi Pico
- Resistor x 6
Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.
First Python
Blink two LEDs, type Python live into the board, and make choices with if.
| Lesson | Time | What students do |
|---|---|---|
| Blink, and talk to the boardYour first MicroPython program blinks two LEDs, then you type Python straight into the board with the REPL. | 25 min |
|
| Buttons and ifRead a button with a pull-up, make a choice with if and else, and print only when something changes. | 25 min |
|
Materials
- LED
- Pushbutton
- Raspberry Pi Pico
- Resistor
Check for understanding
Each student finishes "Buttons and if" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Turn it round".
Loops and sensors
Fade with a for loop and PWM, and read a knob with the ADC.
| Lesson | Time | What students do |
|---|---|---|
| Loops and a PWM fadeA for loop with range() steps an LED from dark to bright and back, using PWM to fake the levels in between. | 25 min |
|
| Read a sensor with the ADCA knob on GP26 turns into a number with ADC, and that number sets the LED brightness. Then a little math turns it into a percent. | 25 min |
|
Materials
- LED
- Potentiometer
- Raspberry Pi Pico
- Resistor
Check for understanding
Each student finishes "Read a sensor with the ADC" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Your own scale".
Bigger programs
Lists and functions on an LED bar, and text on an OLED over I2C.
| Lesson | Time | What students do |
|---|---|---|
| Lists and functions on an LED barSix LEDs in one list, and two small functions that turn a number into a moving dot or a growing bar. | 25 min |
|
| I2C to an OLED screenTwo wires carry a whole conversation: find the OLED and a weather sensor on I2C, then draw text on the screen. | 25 min |
|
Materials
- Full-size breadboard
- LED x 6
- OLED display, 128x64
- Pressure, humidity and temperature, BME280
- Raspberry Pi Pico
- Resistor x 6
Check for understanding
Each student finishes "I2C to an OLED screen" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Your own screen".
Boss game
A reaction timer with a random wait, a cheat catcher and a best score.
| Lesson | Time | What students do |
|---|---|---|
| Boss game: reaction timerWait for the light, then hit the button. Functions, if, loops, random and the board clock come together in one game that keeps your best score. | 25 min |
|
Materials
- LED
- Pushbutton
- Raspberry Pi Pico
- Resistor
Check for understanding
Each student finishes "Boss game: reaction timer" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it yours".
Teach this unit as a class
Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.
The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.