Page 1 of 2
Author
Message
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11636
Posted: 01:42pm 16 Jul 2026
Copy link to clipboard
Print this post
Free Pico Computer 3 if you know python/micropython and are prepared to do some serious testing and proof reading I've written a book about learning to use Micropython on the Pico Computer 3. I need someone to help proof read this in detail and test all the example programs. If you want to help let me know For info, the contents of the book are as follows: Quote Chapter 1 — What is the Pico Computer 3? 1 A computer that boots straight into a language . . . . . . . . . . . . . . . . . 1 A tour of the hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 What is a program? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Why Python? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 How to use this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Chapter 2 — Getting started: flashing and first boot 6 What you will need . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Step 1 — Get the firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Step 2 — Flash the firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Step 3 — Wire up and switch on . . . . . . . . . . . . . . . . . . . . . . . . . 7 Step 4 — Prove it’s alive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Step 5 — Tell it about your keyboard . . . . . . . . . . . . . . . . . . . . . . . 8 If something doesn’t work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Chapter 3 — Your first conversation with Python 11 The world’s most overqualified calculator . . . . . . . . . . . . . . . . . . . . 11 Two kinds of division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Words, not just numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 print(), and who is talking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Breaking it on purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Working comfortably . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Borrowing more mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Chapter 4 — Finding your way around: files and the shell 17 Two drives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Where am I? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Making some files to practise on . . . . . . . . . . . . . . . . . . . . . . . . . 18 Folders, copies, and moves . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Wildcards: acting on many files at once . . . . . . . . . . . . . . . . . . . . . 19 The SD card and your PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 fm — the file manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Chapter 5 — Writing real programs: the editor 22 Your first program file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Getting comfortable in the editor . . . . . . . . . . . . . . . . . . . . . . . . . 23 When programs go wrong: your first debugging workflow . . . . . . . . . . . 23 A program with rhythm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Getting programs in from a PC . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Making a program run at switch-on . . . . . . . . . . . . . . . . . . . . . . . 25 Where you now stand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Chapter 6 — Variables, numbers and text 27 Naming things . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Three kinds of value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 input(): programs that listen . . . . . . . . . . . . . . . . . . . . . . . . . . 29 f-strings: sentences with values inside . . . . . . . . . . . . . . . . . . . . . . 29 Project: a program that chats back . . . . . . . . . . . . . . . . . . . . . . . . 30 Project: a units converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Chapter 7 — Making decisions: if 32 Questions with yes/no answers . . . . . . . . . . . . . . . . . . . . . . . . . . 32 if: the fork itself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 else and elif: covering every road . . . . . . . . . . . . . . . . . . . . . . . 33 and, or, not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Secrets: the random toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Project: the guessing game, round one . . . . . . . . . . . . . . . . . . . . . 35 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Chapter 8 — Repeating yourself: loops 37 while: repeat as long as this is true . . . . . . . . . . . . . . . . . . . . . . . 37 The forever loop, on purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 The rematch: finishing the guessing game . . . . . . . . . . . . . . . . . . . . 38 for and range(): when you know how many . . . . . . . . . . . . . . . . . . . 39 Loops you can see . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 break and continue: steering mid-loop . . . . . . . . . . . . . . . . . . . . . . 41 Project: the times-table dojo . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Chapter 9 — Turtle graphics: loops you can see 43 First steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 The square, and the moment of the chapter . . . . . . . . . . . . . . . . . . . 44 Every polygon at once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Stars: when the turtle overshoots . . . . . . . . . . . . . . . . . . . . . . . . 45 Spirals: let the steps grow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Nested loops: the flower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Project: the spirograph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Chapter 10 — Collections: lists, tuples and dictionaries 49 Lists: an ordered, changeable crowd . . . . . . . . . . . . . . . . . . . . . . . 49 Walking a list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Slices: a piece of the list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Tuples: values that belong together . . . . . . . . . . . . . . . . . . . . . . . 53 Dictionaries: look things up by name . . . . . . . . . . . . . . . . . . . . . . 54 Choosing your container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Project: the high-score table . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Project: the quiz, grown up . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 What you now hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Chapter 11 — Functions: building your own commands 58 def: teaching, then telling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Parameters: one function, a family of jobs . . . . . . . . . . . . . . . . . . . . 59 return: functions that answer . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Scope: the sealed room . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 The refactor: chapter 9, four lines at a time . . . . . . . . . . . . . . . . . . . 61 Project: your shapes library . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 What you now hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Chapter 12 — Strings and files 66 Strings are sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 String methods: the text workshop . . . . . . . . . . . . . . . . . . . . . . . . 66 Split and join: strings ↔ lists . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Files, the full story . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Project: the diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Project: scores that survive — a library . . . . . . . . . . . . . . . . . . . . . 69 Jumping around: seek, tell and fixed-length records . . . . . . . . . . . . . . 71 One more gift: sort meets your functions . . . . . . . . . . . . . . . . . . . . 72 What you now hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Chapter 13 — When things go wrong: errors and debugging 74 What an exception actually is . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 try: the safety net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Catch precisely . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Hearing what happened: as e . . . . . . . . . . . . . . . . . . . . . . . . . . 76 raise: sounding the alarm yourself . . . . . . . . . . . . . . . . . . . . . . . 76 The rogues’ gallery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Hunting bugs: the other half . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Project: the bulletproofing pass . . . . . . . . . . . . . . . . . . . . . . . . . 78 What you now hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Chapter 14 — Objects: a gentle introduction to classes 81 The problem classes solve . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 The blueprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Methods: the rules move in . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 print(h) — teaching your object to speak . . . . . . . . . . . . . . . . . . . . 83 Objects in collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Project: the character sheet, playable . . . . . . . . . . . . . . . . . . . . . . 84 Project: the bank account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 You’ve been here all along . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 What you now hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Chapter 15 — The screen up close 88 How the picture actually works . . . . . . . . . . . . . . . . . . . . . . . . . . 88 The four screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 The map: coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Colour: mixing light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 The toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Words on the screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Project: the poster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Project: the living clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Chapter 16 — Bitmap images and sprite sheets 95 Putting a picture on the screen . . . . . . . . . . . . . . . . . . . . . . . . . . 95 The colour squeeze, and dithering . . . . . . . . . . . . . . . . . . . . . . . . 95 Transparency, part one: PNG alpha . . . . . . . . . . . . . . . . . . . . . . . 96 Sprite sheets: pictures held in memory . . . . . . . . . . . . . . . . . . . . . 96 hdmi.blit: the universal rectangle mover . . . . . . . . . . . . . . . . . . . . 97 An asset pipeline with no PC . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Project: the photo frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Chapter 17 — Smooth motion: buffers and the overlay 101 Stage 0: the smear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Stage 1: the eraser — and the blink . . . . . . . . . . . . . . . . . . . . . . . 102 Stage 2: vsync — drawing between the frames . . . . . . . . . . . . . . . . . 102 Stage 3: the off-screen buffer — frames built in private . . . . . . . . . . . . . 103 The overlay: motion without redrawing the world . . . . . . . . . . . . . . . . 105 The scenery cheat: blit-scrolling . . . . . . . . . . . . . . . . . . . . . . . . . 106 Choosing your weapon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Project: the immortal screensaver . . . . . . . . . . . . . . . . . . . . . . . . 107 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Chapter 18 — Sprites 110 A small loan from chapter 21 . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Sprites from nowhere: grab . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Collisions: the engine speaks . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Project: the shooting gallery . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Chapter 19 — Tile maps: big worlds from small pieces 117 Forging the tileset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 A first map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 The camera: worlds beyond the screen . . . . . . . . . . . . . . . . . . . . . 119 Walking on the world . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Project: the island . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Chapter 20 — Sound and music 125 Playing files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 A one-minute physics lesson . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 tone(): two sine waves, endless patience . . . . . . . . . . . . . . . . . . . . 126 Project: the tune player . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 sound(): the four-voice synthesiser . . . . . . . . . . . . . . . . . . . . . . . 127 Project: the sound-effects library . . . . . . . . . . . . . . . . . . . . . . . . . 127 Tracker music: the game soundtrack . . . . . . . . . . . . . . . . . . . . . . 129 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Chapter 21 — Reading the player: keyboard, mouse and touch 131 keydown(), the whole truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 keyboard.on_key(): the doorbell . . . . . . . . . . . . . . . . . . . . . . . . . 132 The mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 The touch panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Project: paint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Interlude: a stopwatch for the machine . . . . . . . . . . . . . . . . . . . . . 135 Project: the reaction duel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Chapter 22 — Anatomy of a game 138 The loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Frame timing: the metronome . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Game state: one variable, whole architecture . . . . . . . . . . . . . . . . . . 139 Project: Pong, part one — the rally . . . . . . . . . . . . . . . . . . . . . . . . 140 Project: Pong, part two — the match . . . . . . . . . . . . . . . . . . . . . . . 142 What you now hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Chapter 23 — Breakout 147 The whole game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 The wall is a list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Which face did the ball hit? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 The economy: lives, levels, ramp . . . . . . . . . . . . . . . . . . . . . . . . . 151 Someone else’s Breakout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Chapter 24 — Asteroids: vectors, crowds and particles 154 The two lines of trigonometry . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Stage one: flight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Stage two: the game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 Chapter 25 — The adventure: NPCs, dialogue and saved worlds 164 The forge, extended . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 The game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 The just-pressed pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 Dialogue is a state, and the words are data . . . . . . . . . . . . . . . . . . . 171 The save file: derive, don’t store . . . . . . . . . . . . . . . . . . . . . . . . . 171 What this chapter proves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Chapter 26 — Polish: the last ten percent 173 The juice lab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 The component: three-initial entry . . . . . . . . . . . . . . . . . . . . . . . . 176 Difficulty: the curve is the game . . . . . . . . . . . . . . . . . . . . . . . . . 178 Playtesting: the mum test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 The shippable checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Chapter 27 — Building apps: the GUI toolkit 180 The model: describe, then poll . . . . . . . . . . . . . . . . . . . . . . . . . . 180 The pointer: pccursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 The catalogue, briskly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 Project: the calculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 Project: the settings screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Chapter 28 — Time and schedules: the real-time clock 190 The three clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Anatomy of a time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Date arithmetic: mktime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Project: the kitchen timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Project: the bedside alarm clock . . . . . . . . . . . . . . . . . . . . . . . . . 193 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Chapter 29 — Going online: Wi-Fi and the internet 197 Connecting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 The first fruit: atomic time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 Asking the web a question . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 JSON: the internet’s data, in a familiar costume . . . . . . . . . . . . . . . . . 198 Project: the weather panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 A taste of MQTT: machines talking to machines . . . . . . . . . . . . . . . . . 201 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Chapter 30 — Numbers at speed: the maths lab 203 plot(), properly this time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Arrays: the loops vanish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Where the rest lives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 The pcmath bench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 Project: the maths lab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Chapter 31 — Talking to the outside world: GPIO 209 The header map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Output: your first electron . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Input: buttons, and why pins float . . . . . . . . . . . . . . . . . . . . . . . . 210 Analogue: the knob . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 PWM: pretending, very fast . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 I2C and the QWIIC socket: the module ecosystem . . . . . . . . . . . . . . . 212 Project: the paddle controller . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 Chapter 32 — Doing several things at once 216 The tap on the shoulder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Pin interrupts: the doorbell . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 The promise kept: waking to the DS3231 . . . . . . . . . . . . . . . . . . . . 218 The watchdog: for machines left alone . . . . . . . . . . . . . . . . . . . . . . 219 The rules of the tap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 asyncio: the polite jugglers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Project: the game that downloads . . . . . . . . . . . . . . . . . . . . . . . . 220 A note on threads, and why not . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Chapter 33 — Performance and memory 225 The stopwatch, made permanent . . . . . . . . . . . . . . . . . . . . . . . . . 225 Why Python costs what it costs . . . . . . . . . . . . . . . . . . . . . . . . . . 226 The real ladder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Memory: the other resource . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 The worked session: a swarm, tuned . . . . . . . . . . . . . . . . . . . . . . . 229 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Chapter 34 — The system itself 231 The five seconds after the switch . . . . . . . . . . . . . . . . . . . . . . . . . 231 The geography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 The backup habit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Trust, verified: the test suite . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Reading the machine’s own source . . . . . . . . . . . . . . . . . . . . . . . . 233 Where the road goes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 The end of the course . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Appendix A — The cheat sheet 236 The shell (chapter 4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 fm keys (chapter 4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 The editor, pye (chapter 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 The prompt (chapters 3, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 Screen (chapters 15–17) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Input (chapters 18, 21) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Sound (chapter 20) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Games (chapters 18, 19, 22) . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Time & system (chapters 28, 34) . . . . . . . . . . . . . . . . . . . . . . . . . 238 GPIO (chapter 31) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 The collars (never forgotten) . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Appendix B — Coming from MMBasic 239 Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Files and the shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Screen and graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 Input, sound, time, events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Appendix C — The modules, one paragraph each 244 The board’s own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 The standard library (the ones this book used) . . . . . . . . . . . . . . . . . 245 Your own shelf (built through the book) . . . . . . . . . . . . . . . . . . . . . 245 Appendix D — Hardware reference 246 The machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 Sockets, switches and buttons . . . . . . . . . . . . . . . . . . . . . . . . . . 246 Flashing (chapter 2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 The I/O header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Reserved pins (unavailable to machine.Pin) . . . . . . . . . . . . . . . . . . . 247 Screen modes (chapter 15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 Appendix E — Python, the taught subset 249 Values and operators (3, 6, 7) . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Strings (3, 6, 12) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Collections (10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Control flow (7, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Functions (11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Classes (14; appendix I for more) . . . . . . . . . . . . . . . . . . . . . . . . . 250 Errors (13) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Files (12) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Modules (11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Built-ins the book used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 MicroPython differences met in this book . . . . . . . . . . . . . . . . . . . . 251 Appendix F — Challenge hints 252 Appendix G — Glossary 254 Appendix H — Troubleshooting 256 Power and boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Keyboard, mouse, touch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Files and SD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 When all else fails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Appendix I — Classes beyond the cottage 260 Inheritance: blueprints from blueprints . . . . . . . . . . . . . . . . . . . . . 260 Custom exceptions: inheritance you’ll actually use . . . . . . . . . . . . . . . 261 __repr__: the other voice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Operator hooks: teaching + and < your types . . . . . . . . . . . . . . . . . . 262 __len__ and __getitem__: passing for a list . . . . . . . . . . . . . . . . . . . 263 CONTENTS x Class attributes: one value, all instances . . . . . . . . . . . . . . . . . . . . 263 @property: computed attributes . . . . . . . . . . . . . . . . . . . . . . . . . 264 @classmethod and @staticmethod . . . . . . . . . . . . . . . . . . . . . . . . . 264 Privacy: the underscore treaty . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Duck typing: the interface is the behaviour . . . . . . . . . . . . . . . . . . . 265 When not to use any of this . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Where to read further . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5994
Posted: 01:59pm 16 Jul 2026
Copy link to clipboard
Print this post
Peter, I do not qualify (haven't the faintest idea about python), but I volunteer in reading the book, so I can learn about uPython. But ... next 3 weeks I will be on holiday. That disqualifies me completely. VolhoutEdited 2026-07-17 00:00 by Volhout PicomiteVGA PETSCII ROBOTS
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 817
Posted: 05:09pm 16 Jul 2026
Copy link to clipboard
Print this post
I know nothing about Python, but am happy to read your book for you, see what I can pick up. (not on holiday for the foreseable future). Kevin.
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 595
Posted: 05:26pm 16 Jul 2026
Copy link to clipboard
Print this post
I like Python and I already have a project in mind to run on your new Pico Computer 3 with Micropython. I will be happy to read your book as well Is it possible to have a desktop version of the environment, like MMB4W or MMB4L, to test my projects?
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 651
Posted: 05:59pm 16 Jul 2026
Copy link to clipboard
Print this post
I’m not sure how quickly this needs to be done, but I’d be happy to do it without the Pico Computer 3. I won't be ordering mine until August though. My son knows Python, and I’ll encourage him to get involved. :-) I’ll learn it myself in the process. Please feel free to send me the PDF or book via private message or email.
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11636
Posted: 07:51pm 16 Jul 2026
Copy link to clipboard
Print this post
pm me with an email address and I'll send you all the book
zeitfest Guru Joined: 31/07/2019 Location: AustraliaPosts: 691
Posted: 11:52pm 16 Jul 2026
Copy link to clipboard
Print this post
It would be better to use Claude (Anthropic) to test your python programs, maybe that has been done already ? That would allow a systematic test against specified version(s) of Python. There are also extensive proof reading apps that can be used.
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11636
Posted: 06:30am 17 Jul 2026
Copy link to clipboard
Print this post
Quote It would be better to use Claude (Anthropic) to test your python programs, Many of them rely on the specific H/W of the Pico Computer 3 and the specific capabilities of the Pico Computer 3 firmwareEdited 2026-07-17 16:45 by matherp
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 595
Posted: 09:50am 17 Jul 2026
Copy link to clipboard
Print this post
I can test it as soon as I have my pico3 board. I think I will have the board in August
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11636
Posted: 09:52am 17 Jul 2026
Copy link to clipboard
Print this post
I'm working on a PC3 emululator for the PC (Linux or WSL) will post progress as/if it occurs Note: I've emailed the book to those who asked for it. If you haven't received it check spamEdited 2026-07-17 20:30 by matherp
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3811
Posted: 02:30pm 17 Jul 2026
Copy link to clipboard
Print this post
I would also like to have the book, please.PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on FOTS
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11636
Posted: 04:03pm 17 Jul 2026
Copy link to clipboard
Print this post
No problem - pm me your email address
scruss Senior Member Joined: 20/09/2021 Location: CanadaPosts: 105
Posted: 08:22pm 17 Jul 2026
Copy link to clipboard
Print this post
MicroPython programmer for about a decade, used to proof-read dictionaries. Would I qualify?
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11636
Posted: 09:00pm 17 Jul 2026
Copy link to clipboard
Print this post
Quote MicroPython programmer for about a decade, used to proof-read dictionaries. Would I qualify? Definitely, send me your snail-mail address and I'll get one in the post. Away from home at the moment so will be Wednesday before it hits the mail.
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 595
Posted: 11:16pm 17 Jul 2026
Copy link to clipboard
Print this post
matherp said I'm working on a PC3 emululator for the PC (Linux or WSL) will post progress as/if it occurs Note: I've emailed the book to those who asked for it. If you haven't received it check spam Hi Peter I haven't received the email. I have checked the spam folder
zeitfest Guru Joined: 31/07/2019 Location: AustraliaPosts: 691
Posted: 01:08am 18 Jul 2026
Copy link to clipboard
Print this post
This might help for some of it - micropython tests
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11636
Posted: 07:17am 18 Jul 2026
Copy link to clipboard
Print this post
Quote I haven't received the email. I have checked the spam folder Definitely in my sent folder. I've sent it again from a gmail address - see if that works
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11636
Posted: 07:21am 18 Jul 2026
Copy link to clipboard
Print this post
Note The Pico Computer has now been claimed. But if anyone else wants the manual drop me a PM with your email address
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 2155
Posted: 09:10am 18 Jul 2026
Copy link to clipboard
Print this post
Well I got to the end of chapter 7 just now and gotta say my PICO 3 computer is getting python on tomorrow So the next part is sourcing that wifi and psram chip so my board can be complete. Regards Bryan
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8964
Posted: 09:42am 18 Jul 2026
Copy link to clipboard
Print this post
From looking at the Contents I reckoned that Chapter 6 or just possibly 7 would be about as far as I could manage. I've never managed to get any further with Python really - not and understand what I was doing anyway. Mick Zilog Inside! nascom.info for Nascom & GeminiPreliminary MMBasic docs & my PCB designs
Page 1 of 2