9. Case 08: Step Counter#

9.1. Introduction#

  • The step counter is a tool that measures calories or calorie consumption by counting steps, distance, speed, time and other data, it helps to control the amount of exercise and prevent insufficient exercise or excessive exercise.

9.2. Function#

  • Count steps by the accelerometer from the micro:bit, and display the data on the micro:bit.

9.4. Picture#


9.5. Software Programming#

9.6. Program#

Show number “MUM” on the micro:bit.


Set NUM=NUM+1 while in shaking.


While pressing button A, set “NUM” as 0.


Link: https://makecode.microbit.org/_5fT7CVV8dCiK

9.7. Result#

  • Display the steps data on the micro:bit and program to clear the data while pressing button A to start another counting.