Last active
April 18, 2019 14:30
-
-
Save martinohanlon/c89d69f72dc56b6be56f4ca4d579f076 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
print("moved") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment