Table of Contents

Temperature and Humidity


Works with the DHT line of low-cost temperature & humidity sensors.

  • Temperature.Read(pin, type) - Reads sensor temperature data on connected pin
    pin: Pin number
    type: DHT11 = 11, DHT12 = 12, DHT22 = 22, DHT21 = 21
    Returns: Temperature in Celsius.

  • Humidity.Read(pin, type) - Reads sensor humidity data on connected pin
    pin: Pin number
    type: DHT11 = 11, DHT12 = 12, DHT22 = 22, DHT21 = 21
    Returns: Humidity level 0 to 100.

This example reads temperature and humidity every one second, using DHT11 sensor and connected to pin 0.

while True:
    print(duelink.Humidity.Read(0, 11))
    print(duelink.Temperature.Read(0, 11))

    time.sleep(1)