Step Counter

Uses

LED Display, buttons, accelerometer

Description

In this project, you will be creating a step counter that will detect the number of steps you take.

Also known as a pedometer, a step counter is a device, usually portable and electronic or electromechanical, that counts each step a person takes by detecting the motion of the person’s hands, hips or legs. Because the distance of each person’s step varies, an informal calibration, performed by the user, is required if presentation of the distance covered in a unit of length (such as in kilometers or miles) is desired, though there are now pedometers that use electronics and software to automatically determine how a person’s step varies. Used originally by sports and physical fitness enthusiasts, pedometers are now becoming popular as an everyday exercise counter and motivator.

../../_images/step-counter.jpg

You will be needing something to hold the microbit to your ankle as you will strap this to detect step count. Display the step count whenever a step is detected. Use the accelerometer ‘shake’ gesture for this. Also use the button a to check for the current step count. Use button b to reset the micorbit.

Basic Task

  1. Check for accelerometer gesture if there is a ‘shake’ detected. Use a variable to count up, and display the count on the LED. Make sure to use the wait=False parameter on the display so that it will still count up even if display is being executed.
  2. Pressing button a will display the current step count.
  3. Pressing button b will reset the microbit. (hint: use reset()to do this).