Skip to content

Project: Micro:bit Podometer

Every time we detect a step (as a gesture), we increase a counter and show it on the display.

Since we can show only one figure at a time, when the number is greater than 10 we scroll the text.

from microbit import *

steps = 0
display.show(str(steps))

while True:
    if accelerometer.was_gesture("shake"):
        steps += 1
        if steps < 10:
            display.show(str(steps))
        else:
            display.scroll(str(steps))