Il programma deve inviare un'immagine se raggiunge una certa temperatura, mi aiuti?
Grazie
from sense_hat import SenseHat
import time
sense = SenseHat()
sense.low_light = True
Orange = (0,0,255)
White = (255,255,255)
Black = (0,0,0)
while True:
t = sense.get_temperature()
t = round(t, 1)
def Flame1():
W = Black
Y = White
O = Orange
pixel_list = [W, W, W, W, Y, W, W, W,
W, Y, W, W, W, W, W, W,
O, W, W, W, O, Y, W, W,
W, W, Y, W, W, W, W, O,
W, O, W, W, O, W, Y, Y,
W, W, W, W, W, W, O, W,
Y, Y, Y, Y, Y, Y, Y, Y,
Y, Y, Y, Y, Y, Y, Y, Y]
sense. set_pixels (pixel_list)
def Flame2():
W = Black
Y = White
O = Orange
pixel_list = [W, W, W, W, Y, W, W, O,
W, Y, W, W, W, W, W, W,
O, W, W, W, O, Y, W, W,
W, W, O, O, W, W, W, O,
W, O, W, W, O, W, Y, Y,
W, W, W, W, W, W, O, W,
Y, Y, Y, Y, Y, Y, Y, Y,
Y, Y, Y, Y, Y, Y, Y, Y]
sense. set_pixels (pixel_list)
FlameImages = [Flame1,Flame2]
count = 0
if t > 40:
msg = "%s" % (t)
sense.show_message(msg, scroll_speed=0.05)
if ((t >= 10) & (t <= 40)):
msg = "%s" % (t)
sense.show_message(msg, scroll_speed=0.05)
if t < 10:
msg = "%s" % (t)
sense.show_message(msg, scroll_speed=0.05)
while True:
sense.set_pixels(FlameImages[count % len(FlameImages)]())
time.sleep(1.50)
count += 1