timber101

Astro_Pi_2022

Mar 4th, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. from sense_hat import SenseHat
  2. from time import sleep
  3. sense = SenseHat()
  4. sense.set_rotation(270)
  5.  
  6. sense.show_message("My name should be Colin", scroll_speed = 0.01)
  7.  
  8. yellow = (255,255,0)
  9. green =(0,255,0)
  10. red = (255,0,0)
  11. o=(255,130,0)
  12. b=(0,0,255)
  13. c=(0,150,255)
  14. e=(80,80,80)
  15. g=(0,255,0)
  16. y=(255,255,0)
  17.  
  18. sense.show_message("Colin", scroll_speed = 0.05, text_colour=yellow, back_colour = red )
  19. sleep(1)
  20.  
  21. wet = [
  22.   b, b, b, b, b, b, b, b,
  23.   b, b, b, b, b, b, b, b,
  24.   b, o, b, o, o, o, b, b,
  25.   b, o, o, o, o, e, o, b,
  26.   b, o, o, o, o, o, o, b,
  27.   b, o, b, o, o, o, b, b,
  28.   b, b, b, b, b, b, b, b,
  29.   b, b, b, b, b, b, b, b
  30. ]
  31.  
  32. sense.set_pixels(wet)
  33.  
  34. dry = [
  35.   c, c, g, g, c, c, c, c,
  36.   c, c, g, g, c, g, c, c,
  37.   g, c, g, g, c, g, c, c,
  38.   g, c, g, g, c, g, c, c,
  39.   g, g, g, g, g, g, c, c,
  40.   c, c, g, g, c, c, c, c,
  41.   y, y, y, y, y, y, y, y,
  42.   y, y, y, y, y, y, y, y
  43. ]
  44.  
  45. humid = round(sense.get_humidity(),1)
  46. sleep(1)
  47. sense.show_message("The humidity is " + str(humid) + " %")
  48.  
  49. if humid >= 40:
  50.     sense.set_pixels(wet)
  51. else:
  52.     sense.set_pixels(dry)
Add Comment
Please, Sign In to add comment