from microbit import *

compass.calibrate()

while True:
    if compass.heading() < 90 or compass.heading() > 270:
        display.show("N")
        sleep(1000)
        display.clear()
    else:
        display.show("S")
        sleep(1000)
        display.clear()