from microbit import *
compass.calibrate()
while True:
heading = compass.heading()
if heading < 45 or heading > 315:
display.show(Image.HAPPY)
else:
display.show(Image.SAD)
Copyright ⓒ TECH79 All right reserved