# Step counter: a free micro:bit lesson from Maze Education
# https://maze.education/microbit/lessons/step-counter
# MicroPython for the micro:bit Python Editor: https://python.microbit.org

# Step counter: every shake adds one. A shows the total, B resets it.
from microbit import *

steps = 0
while True:
    if accelerometer.was_gesture("shake"):
        steps += 1
    if button_a.was_pressed():
        display.scroll(steps)
    if button_b.was_pressed():
        steps = 0
        display.show(Image.YES)
    sleep(50)
