from sense_hat import SenseHat
import time

hat = SenseHat()
fill = (255, 0, 0)

while True:
	reading = int(hat.get_compass_raw()['z']
	if reading > 200:
		hat.clear(fill)
		time.sleep(0.2)
	else:
		hat.clear()
