Walking for Water Lesson 2

In this lesson students design and code their step-counter to track their steps so they can walk as many steps as Aysha does in one day in 4 days.

  • Global challenge
  • computing
Print lesson
  • Âges 9+
  • 60 min
  • MakeCode Editor

Contenus notionnels

  • Computing: computational thinking: logical reasoning, algorithms, decomposition, abstraction, iteration, loops, variables, testing, debugging, paired programming
  • Science: The heart, sensors
  • E.P.: L'importance de l'exercice régulier
  • Éducation à la santé, formation personnelle et sociale: Un corps et un esprit sains
  • Design et technologie: La conception de produits

Skills: Empathy, problem solving, team working, designing, creative thinking, prototyping


It is assumed that you have first completed the Non-communicable disease introductory lesson and Walking for Water lesson 1. Some experience of writing algorithms and programming is assumed, although you can extend these sections easily as required by your students.


In this lesson students design and code their step-counter to track their steps so they can walk as many steps as Aysha does in one day in 4 days (or your allocated time). They firstly decompose the task and write the algorithm before using the MakeCode editor to program their tracker using micro:bit’s accelerometer, iteration and variables. If you are using micro:bit boards, they also create and test their step-tracker.

Teacher Guide

Open Afficher les ressources pour enseignants


Decomposing the task

  • Give students a few moments to think/pair/share how they will approach the task (slide 6) and make a list of the sub-tasks involved on the board, addressing any misunderstandings.
  • Highlight they are using decomposition and abstraction and will be writing algorithms, all key components of computational thinking (slide 7), before programming using iteration and variables and testing and debugging their code (slide 8).

Conception d'algorithme

  • Give out rough paper to students and give them suitable time to design the algorithm for their step-tracker using pseudocode (slide 9). Once they have written an initial draft, ask them to compare with their peers to test and debug it.
  • There is an example algorithm on slide 10, though do encourage students to come up with their own.
  • Depending on your students’ experience, you may need to spend additional time going through the concepts included in the algorithm, or ask them to use simple language rather than pseudocode.

Walking challenge

  • Once students have a workable algorithm, invite them to program their step-counters using the MakeCode editor (using paired programming if you wish - slide 11).
  • Remind students to test and debug their code regularly, using logical reasoning to work through any errors with their peers.
  • As they finish, ask them to share their work with their peers to help them test and refine their code and explore different ways of achieving the same goal.
  • Sample code is given on slide 12 and in the downloadable hex file.
  • If you are using micro:bit boards, students should save and upload the file to the micro:bit, attach the battery pack and strap it to their leg or shoe using a rubber band or with a strap. They can then test and debug the physical step-tracker.

Screenshots of example code can be found in the lesson presentation slides above, or you may wish to download the example hex files.

Lesson wrap up

  • Invite students to share their learning from coding their step-tracker, E.g:
  • What problems did they have and how did they solve them?
  • What different ways did they find to achieve the same goal?
  • Revisit the learning objectives if you wish on slide 13.

Extension / homework

  • Students could screenshot, print and annotate their code to show how they have used iteration and variables and why, or they could create a screen recording to talk through their algorithm and program.



  • Encourage students to write a simple algorithm using everyday language and you could them the text instructions and ask them to sequence them into the correct order. Students may need additional support to program a simple step-tracker and sequencing printed code blocks first may help.

Stretch & challenge:

Students can be challenged to create multiple highly accurate algorithms and code for more advanced features (e.g. can they add a start and stop button, or include an audio and visual indicator that the step target has been achieved?)

Opportunities for assessment:

  • Informal assessment during activities, showcase and through questioning.
  • More formal assessment if wished of students’ algorithms and code.
Selecting this opens external content from our support system, which adheres to their privacy policy.