def gettemp(): while True: time.sleep(5) (x, y) = hfv.dht11_temp_humi('dht11v2.0', 'docker_remote') # x为温度,y为湿度 x = float(x) y = float(y) print("The tempreture is: %f" % x + '\n' + "The humidity is: %f" % y) err = "The trade is not vaild!" break return x ## 返回温度
import hfv import time while True: (temp, humi) = hfv.dht11_temp_humi('dht11v2.0', 'host') print(temp) time.sleep(10)
import hfv print(hfv.dht11_temp_humi('dht11', 'host'))
def new_samples(): (x,y) = hfv.dht11_temp_humi('dht11','docker') return np.array([[x,y]], dtype=np.float32)