Skip to content

Step counter

Lesson 4 of 6

MakeCode

7-11 yrs

Introduce variables to track your step count and begin to use the accelerometer input.

Key learning:

  • Understand how sensor inputs from the accelerometer can be used to detect movement, such as when a step is taken.
  • Understand that variables are used to keep track of the current step count.
  • Understand that the order of instructions is important: display the variable’s value after updating it, not before.
  • Apply this learning to build a practical, real-world project.

Computer systems:

Input/output

Sensors

Programming:

Variables

Lesson plan preview

Slides preview

Student handouts

Completed lesson code

This provides an example of the code created during this lesson.

You may also be interested in

Unit of work

Nature art

This unit of four lessons is suitable for students aged 7-8 years. They create nature representations, firstly using art materials and are introduced to computational thinking and programming the LEDs on the BBC micro:bit. 

Make it: code it

Name badge

Turn your micro:bit into an animated name badge