Source: https://mokxi.com/teachers/plans/micropython-screen-games
Updated: 2026-11-19

Lesson plan

# MicroPython games on a tiny screen lesson plan

Build space games in MicroPython on a Pico with an OLED: drawing, a game loop, buttons, a score, random asteroids, sound, and a space snake.

4 chapters, 7 lessons, about 5 hours, on the Raspberry Pi Pico. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- Draw pixels, boxes and text on a 128 by 64 OLED, then make a ship move with a game loop.
- Steer with two buttons, catch stars with box collisions, and keep score.
- A random asteroid field with lives and levels, and sound from a piezo.
- Everything at once: a space snake with steering, food, growth, sound and warp edges.

### Materials for the whole unit

- OLED display, 128x64
- Piezo speaker
- Pushbutton x 2
- Raspberry Pi Pico

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.

Chapter 1. About 1 h 30 min

## The screen

Draw pixels, boxes and text on a 128 by 64 OLED, then make a ship move with a game loop.

Lesson | Time | What students do

Drawing on an OLED Light pixels, lines, boxes and text on a 128 by 64 OLED, and learn why nothing shows until show(). | 45 min

- Run it
- x across, y down
- Fill the ship
- Add a planet
- Your own title screen

Moving a dot The game loop every game runs: clear, draw, show, move. Bounce a ship off the walls and measure your frame rate. | 45 min

- Run it
- Predict the bounce
- Twice as fast
- Up and down too
- Frames per second

### Materials

- OLED display, 128x64
- Piezo speaker
- Pushbutton x 2
- Raspberry Pi Pico

### Check for understanding

Each student finishes "Moving a dot" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Frames per second".

Chapter 2. About 1 h 20 min

## Play

Steer with two buttons, catch stars with box collisions, and keep score.

Lesson | Time | What students do

Reading buttons Steer the ship with two buttons: pull-ups, why pressed reads 0, held versus tapped, and the bounce you never see. | 40 min

- Hold A
- Hold B
- Faster steering
- Count taps, not frames

A score Catch stars with box collisions, keep score, draw it with % formatting, and end the game after three misses. | 40 min

- Catch one
- Boxes that touch
- Score on the screen
- Three misses and out

### Materials

- OLED display, 128x64
- Piezo speaker
- Pushbutton x 2
- Raspberry Pi Pico

### Check for understanding

Each student finishes "A score" 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: "Three misses and out".

Chapter 3. About 1 h 20 min

## Danger and noise

A random asteroid field with lives and levels, and sound from a piezo.

Lesson | Time | What students do

Random enemies An asteroid field from random numbers and a list: spawn, move, clear away, crash. Then lives and levels. | 40 min

- Into the field
- Random, but the same
- Three lives
- It gets harder

Sound Make a piezo sing with PWM: a start jingle, a crash sound, the lowest note the Pico can make, and a tune stored as a list. | 40 min

- The start jingle
- A crash sound
- How low can it go?
- A tune as a list

### Materials

- OLED display, 128x64
- Piezo speaker
- Pushbutton x 2
- Raspberry Pi Pico

### Check for understanding

Each student finishes "Sound" 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: "A tune as a list".

Chapter 4. About 55 min

## Project: snake

Everything at once: a space snake with steering, food, growth, sound and warp edges.

Lesson | Time | What students do

Project: snake Build space snake: a grid, a list of cells for a body, two-button steering, food, growth, sound, speed-ups and warp edges. | 55 min

- First bite
- Into the wall
- Steer it
- Faster as it grows
- Warp edges
- Make it yours

### Materials

- OLED display, 128x64
- Piezo speaker
- Pushbutton x 2
- Raspberry Pi Pico

### Check for understanding

Each student finishes "Project: snake" on their own, without opening the hints. The simulator checks 6 of its 6 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".

Your class

## 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.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
