Welcome! This guided tutorial will show you how to program a script that displays the direction the BBC micro:bit is pointing. Let's get started!
Create a loop that will continuously update the reading of the compass.
Store the reading of the micro:bit in a variable called
degrees is less than
45, then the compass heading is mostly pointing toward North. Display
N on the BBC micro:bit.
degrees is less than 135, the micro:bit is mostly pointing East. Display
E on the BBC micro:bit.
degrees is less than 225, the micro:bit is mostly pointing South. Display
S on the BBC micro:bit.
If none of these conditions returned true, then the BBC micro:bit must be pointing West. Display
W on the BBC micro:bit.
Excellent, you're ready to continue with the challenges