Never get lost with your micro:bit in compass mode! This project will show you how to display the micro:bit’s bearing from magnetic North in degrees. You can also boost your comfort and range using a CHARGE pack for your micro:bit!
Input drawer: grab the “compass heading (°)” block and drop it onto the 0 in “show number 0”
Download your code:
When you press button A, you’ll be told to “Tilt to fill screen,” hold the micro:bit flat or parallel with the ground and then tilt the micro:bit until all the LEDs are lit up.
You have now calibrated the micro:bit and now when you press button A, it will display the direction in degrees.
Remember to hold the micro:bit flat to get the most accurate results!
Or experiment with the finished code here:
Use the Compass:
Now attach the micro:bit to your wrist, turn on the CHARGEand check which direction you’re facing! Remember that North is 0 degrees and goes up clockwise.
Make it better:
Now if you didn’t want to try and remember how many degrees each direction is, can you think of a way to display a letter or two instead of the number? Hint: IF statement codeblocks.