boshadog

Untitled

Jun 11th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. from sense_hat import SenseHat
  2. import time
  3.  
  4. sense = SenseHat()
  5. sense.clear()
  6.  
  7. sense.scroll_speed = 5
  8.  
  9. white = (0, 0, 0)
  10. blue = (0, 0, 255)
  11. red = (255, 0, 0)
  12. purple = (128, 0, 128)
  13. black = (255, 255, 255)
  14. orange = (182, 129,35)
  15.  
  16. while True:
  17. temp = round(sense.get_temperature(), 1)
  18. humidity = round(sense.get_humidity(), 1)
  19. pressure = round(sense.get_pressure(), 1)
  20.  
  21. print(str((temp * 1.8) + 32) + ' Fahrenheit')
  22. sense.show_message(str((temp * 1.8) + 32) + 'F', text_colour=red, back_colour=white)
  23.  
  24. print(str(humidity) + '% Humidity')
  25. sense.show_message(str(humidity) + '%', text_colour=purple, back_colour=white)
  26.  
  27. print(str(pressure * 100) + 'Pa')
  28. sense.show_message(str(pressure * 100) + 'Pa', text_colour=orange, back_colour=white)
  29.  
  30. time.sleep(1)
Add Comment
Please, Sign In to add comment