Skip to content

Instantly share code, notes, and snippets.

Last active April 18, 2019 14:30
What would you like to do?
from sense_hat import SenseHat
def display_acceleration(x, y, z):
print("{:06.2f}|{:06.2f}|{:06.2f}".format(x, y, z))
sense = SenseHat()
while True:
acceleration = sense.get_accelerometer_raw()
x = acceleration['x']
y = acceleration['y']
z = acceleration['z']
# display_acceleration(x,y,z)
x = abs(x)
y = abs(y)
z = abs(z)
if x > 1 or y > 1 or z > 1:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment