TS7-Pro 7-inch Touch Screen
Code Explanation
dht11 = DHT11.DHT11(17)
Instantiate a dht11 object.
def getTem():
result = dht11.get_result()
while True:
if result:
break
else:
result = dht11.get_result()
return result[1]
The temperature (result[1]) is obtained by this function, and the function will not be interrupted until the reading
is successful.
def getHum():
result = dht11.get_result()
while True:
if result:
break
else:
result = dht11.get_result()
return result[0]
The humidity (result[0]) is obtained by this function, and the function will not be interrupted until the reading is
successful.
variables = {
'Room Temp': {
(continues on next page)
5.5. Cloud4RPi 113