The micro:bit also has a compass (magnetometer)
The compass has to be calibrated before it can give accurate readings. Calibration involves moving a dot to make a circle on the matrix. Once this is complete you get a smiling face image displayed to show you that you have successfully completed the calibration.
Again you will need to click on the REPL button in the mu editor prior to flashing the micro:bit
Move the Micro:bit about and you should see different values in the console, 0 is equivalent to North
from microbit import * compass.calibrate() while True: bearing = compass.heading() print(bearing) sleep(100)
As part of an experiment you could use the display object to display one of the corresponding images