Iteration & Looping
This unit introduces the concept of iteration—or ways to make things repeat. In MakeCode, this is accomplished with loop blocks. You will learn to code with three types of loop blocks as well as sprite and music blocks. In the project, you’ll code your own unique program using loops, variables, and other blocks you’ve explored and learned. You’ll design and build an object that uses sound, display, and motion in some way. To incorporate sound and motion, additional materials such as micro-servo motors (a small motor) and crocodile clips are recommended for Lessons B and C.
Lesson objectives
You will…
- Understand the value of iteration in programming
- Understand looping as a form of iteration
- Learn how and when to use the Looping blocks ‘repeat’, ‘while’, and ‘for’
- Apply the above knowledge and skills to create a unique program that uses iteration and looping as an integral part of the program
Lesson structure
- Introduction: Lather. Rinse. Repeat.
- micro:bit Activities: Code a sprite to walk a Square, travelling light, micro:bit alarm!
- Project: Get Loopy!
- Project Mods: Use servo motors to add a motion element to the project
- Reflection: Write a short journal entry
- Standards: Listed