Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- from sense_hat import SenseHat
- from subprocess import call
- sh = SenseHat()
- sh.set_rotation(90)
- sh.show_message("Let's begin Act I...", text_colour=[0, 50, 220], scroll_speed=.055)
- time.sleep(4)
- replies = ['Scene 1, Ln 12-3',
- 'Scene 3, Ln 14-5',
- 'High five Roman +1',
- 'Scene 6, Ln 87-9',
- 'Chicken Dance +2',]
- while True:
- x, y, z = sh.get_accelerometer_raw().values()
- x = abs(x)
- y = abs(y)
- z = abs(z)
- if x > 2 or y > 2 or z > 2 :
- sh.show_message(random.choice(replies), text_colour=[0, 50, 220], scroll_speed=.055)
- elif x==0 and y==0 and z==0 :
- time.delay(240)
- sh.show_message("Time to shutdown!", text_colour=[0, 50, 220], scroll_speed=.055)
- time.delay(1)
- call("sudo nohup shutdown -h now", shell=True)
- else:
- sh.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement