Microbit
Beginner
40 mins
Teacher/Student led
+140 XP
Pupils work on their own device

Studio: Step Counter

Students build a wearable micro:bit step counter, test it while walking, adjust the count for one-sided shake detection, and explain where the reading goes wrong.

Teacher Class Feed

Load previous activity

    1 - Start: What We're Building ~4 mins

    Illustration for Start: what we're buildingToday you are coding with the micro:bit. You will build a wearable step counter you can walk with, watch the count on the LEDs, and check how accurate it is.

    You already know how to open a MakeCode project and send code to a micro:bit. We will predict, build step by step, run it on the board, investigate the count, modify it, and test again.

    What do you think the micro:bit can sense so it knows you took a step?

    2 - Create a New Microbit Project ~2 mins

    Go to the makecode.microbit.org website and create a new project.

    3 - Create the 'Steps' Variable ~2 mins

    We will need to remember the amount of steps we've taken so we will create a variable called 'steps'.

    4 - Setup the 'Steps' Variable ~2 mins

    When we start the 'steps' should be 0. Add the following code:

    let steps = 0
    
    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2026. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more