示例#1
0
def get_humidity():
    sensor = DHT(DHTpin)
    status = sensor.readDHT11()
    if status is sensor.DHTLIB_OK:
        return sensor.humidity
    else:
        return None
示例#2
0
def get_temperature():
    sensor = DHT(DHTpin)
    status = sensor.readDHT11()
    if status is sensor.DHTLIB_OK:
        return sensor.temperature
    else:
        return None
示例#3
0
def get_temperature():
    global current_temperature
    try:
        sensor = DHT(DHTpin)
        status = sensor.readDHT11()
        if status is sensor.DHTLIB_OK:
            current_temperature = sensor.temperature
    except Exception as e:
        print(e)
示例#4
0
def get_temp():
    dht = DHT(11)
    dht.readDHT11
    return (dht.temperature)