← Code

Program a micro:bit with blocks in the simulator. Pictures, loops, buttons, variables, sensors, decisions and lists, ending in a pocket pet you build yourself.

Start1. Pictures in order

Show and react

Pictures in order, loops that repeat, and code that waits for a button.

Remember and sense

A variable that counts, and sensors that give numbers.

Decide

If, else and else if: the micro:bit chooses what to do.

6IfNot started
7If and elseNot started
8The first true question winsNot started

Add else if to ask more questions in a row, and see that the first true one wins, so their order sets the ranges.

  1. Predict
  2. Run
  3. Investigate › Trace the tilt
  4. Investigate › Leo's tilt
  5. Modify › Fix Leo's tilt
  6. Modify › Left as well
  7. Mix it up
  8. Make
Start lesson

Lists

Many values under one name: pick one by its place, or at random.

Final challenge: Pocket pet

Build a pet that gets hungry, eats and does tricks, in three milestones.

11Pocket petNot started

Build a pet that lives on your micro:bit, using everything in this course. It gets hungry as time passes, you feed it, and its face shows how it feels.

  1. Predict
  2. Run
  3. Investigate › Feeding
  4. Investigate › Faces
  5. Investigate › Tricks
  6. Milestone 1: hungry over time
  7. Milestone 2: a face for each feeling
  8. Milestone 3: tricks
Start lesson

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)