from sense_hat import SenseHat sense = SenseHat() pitch = sense.get_orientation()["pitch"] sense.show_message("Pitch: {}".format(pitch))
from sense_hat import SenseHat sense = SenseHat() img = [[(255, 0, 0) for _ in range(8)] for _ in range(8)] # creates a red 8x8 image roll = sense.get_orientation()["roll"] sense.set_rotation(roll) # rotates the image based on the current roll orientation sense.set_pixels(sum(img, [])) # displays the image on the LED matrixPackage library: SenseHat (built-in to Python on Raspberry Pi)