from microbit import *
if compass.is_calibrated() == False:
compass.calibrate()
x = 2
y = 2
while True:
get_x = compass.get_x()
if get_x < -100:
if x != 4:
x = x + 1
elif get_x > 100:
if x != 0:
x = x - 1
get_y = compass.get_y()
if get_y < -100:
if y != 4:
y = y + 1
elif get_y > 100:
if y != 0:
y = y - 1
display.clear()
display.set_pixel(x,y,9)
sleep(100)
Copyright ⓒ TECH79 All right reserved