Created
April 18, 2019 14:10
-
-
Save martinohanlon/c2379def209411229bc95f45973fe2d3 to your computer and use it in GitHub Desktop.
This file contains 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.6 or y > 1.6 or z > 1.6: | |
print("shaken") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment