• Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    C++
  • License
    Other
  • Created over 11 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Efficient DHT library for Arduino

DHT

An Arduino library for reading the DHT family of temperature and humidity sensors.

Written by Mark Ruys, [email protected].

Features

  • Support for DHT11 and DHT22, AM2302, RHT03
  • Auto detect sensor model
  • Low memory footprint
  • Very small code

Usage

#include "DHT.h"

DHT dht;

void setup()
{
  Serial.begin(9600);

  dht.setup(2); // data pin 2
}

void loop()
{
  delay(dht.getMinimumSamplingPeriod());

  Serial.print(dht.getHumidity());
  Serial.print("\t");
  Serial.print(dht.getTemperature());
}

Also check out the example how to read out your sensor. For all the options, see dht.h.

Installation

Place the DHT library folder in your <arduinosketchfolder>/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the Arduino IDE.