Build a pocket pet lesson plan
A Tamagotchi-style pet on an OLED: a screen, buttons, stats, a clock and a memory, ending with Pip.
Objectives and materials
By the end, students can
- A screen to live on and buttons to talk to it with.
- Stats that fall, a clock that counts pet minutes, and growing up.
- Save the pet in EEPROM, then meet the whole thing.
Materials for the whole unit
- Arduino Uno R3
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3
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.
A home for a pet
A screen to live on and buttons to talk to it with.
| Lesson | Time | What students do |
|---|---|---|
| A face for your petWake a 128x64 OLED over two wires, write on it, and draw a pixel-art egg from flash. The first thing any pet needs is somewhere to live. | 40 min |
|
| Three buttons and a menuSELECT, CONFIRM and CANCEL with no resistors to fit, a menu of six icons, and why a button needs debouncing. | 40 min |
|
Materials
- Arduino Uno R3
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3
Check for understanding
Each student finishes "Three buttons and a menu" 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: "CANCEL backs out".
A life in numbers
Stats that fall, a clock that counts pet minutes, and growing up.
| Lesson | Time | What students do |
|---|---|---|
| A pet made of numbersFood, joy and rest that fall a little every pet minute on a millis() clock, and buttons that put them back. | 40 min |
|
| Growing up and going to bedA clock that counts pet minutes, an egg that hatches, a baby that grows into a kid, and a pet that gets sleepy. | 40 min |
|
Materials
- Arduino Uno R3
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3
Check for understanding
Each student finishes "Growing up and going to bed" 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: "Lights out".
Remember, then play
Save the pet in EEPROM, then meet the whole thing.
| Lesson | Time | What students do |
|---|---|---|
| A pet that remembers youKeep the pet in the Uno EEPROM as one struct with a magic number, save when something happens, and find it again after a reset. | 40 min |
|
| Meet PipEverything together: hatching, feeding, two mini-games, cleaning up, medicine, sleep and a pet that remembers you. | 40 min |
|
Materials
- Arduino Uno R3
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3
Check for understanding
Each student finishes "Meet Pip" 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: "It remembers you".
Teach this unit as a class
Start a class from this course and its 6 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.