SPEC
- Run a continuous loop using
while True:. - Use
sleep()to control timing between frames. - Display a 4-frame LED animation on the micro:bit.
- Button A toggles a boolean variable
running:- When
runningisTrue, the animation plays. - When
runningisFalse, the display is cleared and the animation pauses.
- When
Success Criteria: Uses while True:, uses sleep() for timing, shows a repeating animation, and Button A cleanly starts/stops it.
Pseudocode
SET running = False
FOREVER:
IF Button A was pressed:
running = NOT running
wait 300 ms (debounce)
IF running is True:
FOR each image in frames (4 images):
show image
wait 500 ms
ELSE:
clear display
MicroPython Program (copy to the micro:bit)
You need to research how to code this.
Tip: Adjust the delay (e.g., 500 → 200) to speed up the animation.
The name of the file will be:
PX_lastname_loops
Files to save on Google Drive under your class and submit to Google Classroom
PX_lastname_loops.png— Screenshot inside Python editor showing your code.PX_lastname_loops.py— Your Python source file.PX_lastname_loops.txt— Plain-text copy of your code.PX_lastname_loops.hex— Hex file to run on the physical micro:bit.PX_lastname_loops.mp4— Short demo video of the program running on the board.
Submission requirements
- Show the real micro:bit hardware running your animation to Mr. Cusack.
- Get the secret code word after you demo.
- Include that exact code word in your Google Classroom submission comments.