1 of 1

micro:bit | Step Counter

Connect the micro:bit to MicroBlocks.

Motion

Add the Motion library:

(from the Sensing folder)

The Motion library lets you count your steps as you walk or run. It works by using the built-in tilt sensor to detect your up-down motion as you take a step.

Test these scripts by shaking your micro:bit.

Press the A button to see your step count. Press the B button to reset.

Now, plug in a battery and take your micro:bit for a walk!

How well does it work?

Reset the count, then take 20 steps. What count do you get?

Adjust the sensitivity of the step counter for your own steps. (If taller, increase the threshold.)

CC BY-SA 4.0

v1.1