Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import random
  2. import time
  3. from sense_hat import SenseHat
  4. from subprocess import call
  5.  
  6. sh = SenseHat()
  7.  
  8. sh.set_rotation(90)
  9. sh.show_message("Let's begin Act I...", text_colour=[0, 50, 220], scroll_speed=.055)
  10. time.sleep(4)
  11.  
  12. replies = ['Scene 1, Ln 12-3',
  13. 'Scene 3, Ln 14-5',
  14. 'High five Roman +1',
  15. 'Scene 6, Ln 87-9',
  16. 'Chicken Dance +2',]
  17.  
  18. while True:
  19. x, y, z = sh.get_accelerometer_raw().values()
  20.  
  21. x = abs(x)
  22. y = abs(y)
  23. z = abs(z)
  24.  
  25. if x > 2 or y > 2 or z > 2 :
  26. sh.show_message(random.choice(replies), text_colour=[0, 50, 220], scroll_speed=.055)
  27. elif x==0 and y==0 and z==0 :
  28. time.delay(240)
  29. sh.show_message("Time to shutdown!", text_colour=[0, 50, 220], scroll_speed=.055)
  30. time.delay(1)
  31. call("sudo nohup shutdown -h now", shell=True)
  32. else:
  33. sh.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement