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.
- Computing: computational thinking: logical reasoning, algorithms, decomposition, abstraction, iteration, loops, variables, testing, debugging, paired programming
- Science: The heart, sensors
- P.E.: The importance of regular exercise
- PSHE: Healthy mind and body
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.
- To use decomposition and abstraction effectively to solve a problem
- To write, test and debug accurate algorithms and programs
- To use iteration, loops and variables to write efficient algorithms and code
- Introduction (5 minutes)
- Decomposing the task (10 minutes)
- Algorithm design (15 minutes)
- Programming (15 minutes)
- Testing and debugging (5 minutes)
- Wrap up (10 minutes)
- Use the recap questions on slide 2 for students to think/pair/share what they recall about last lesson
- Remind them of their challenge: they are going to walk as many steps as Aysha does in one day over the course of 4 days (slide 3) and share the learning objectives on slide 4 if you wish.
- Recap that their first task is to create their own step-counter to track their steps using micro:bit (slide 5). (If you do not have physical boards, students can code the MakeCode editor then use a simple pedometer or a phone to track their steps).
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).
- 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.
- 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.