Distance calculator
View full project on microbit.org
To code this project yourself, right click on the background of the workspace and choose ‘delete all blocks’, then follow the coding video below. You can find the forever and on start blocks in the Basic section.
What is it?
Use your BBC micro:bit to measure distances as you walk.
https://www.youtube.com/watch?v=Uzm4Kss4AOA
What you’ll learn
This practical project shows how to use multiplication and variables to measure distances.
How it works
- This program calculates distances by multiplying step length by the number of steps you take. It uses an average child’s step length of 0.6 metres.
- Carefully walk the distance you want to measure, pressing button A each time you take a step.
- The program works by increasing the ‘step count’ variable by one each time button A is pressed.
- Press button B to see the distance you have walked in metres. The micro:bit calculates this by multiplying the ‘step count’ variable by the step length.
- If you want to know how many steps you took, press the touch logo on the front of your micro:bit.
- Reset the micro:bit by pressing the reset button on the back.
Visit the projects page on microbit.org for a full description of this and other projects.
Open this page at https://virat-ops484.github.io/distance-calculator-/
Use as Extension
This repository can be added as an extension in MakeCode.
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- search for https://github.com/virat-ops484/distance-calculator- and import
Edit this project
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/virat-ops484/distance-calculator- and click import
Metadata (used for search, rendering)
- for PXT/microbit