from microbit import *
while True:
sleep(100)
degrees = compass.heading()
if degrees < 45 or degrees > 315:
display.show('N')
elif degrees < 135:
display.show('E')
elif degrees < 225:
display.show('S')
else:
display.show('W')
Copyright ⓒ TECH79 All right reserved