Skip to content

nicolito128/DHT_N128

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DHT_N128

A simple library for using DHT-type sensors (DHT11, DHT22, etc.).

Getting started

Download and import the library in your IDE.

Arduino IDE

Go to Sketch |> Include Library |> Add .ZIP Library...

Usage

#include <DHT_N128.h>

#define PIN 7

DHT dht(PIN, DHTSensorType::DHT22);

void setup() {
  Serial.begin(9600);
  Serial.println("Humidity/Temperature Sensor Example");
  dht.begin();
}

void loop() {
  float rh = dht.readHumidity(); // Relative Humidity
  float temp = dht.readTemperature(); // Default: TempScale::Celsius

  if (isnan(rh) || isnan(temp)) {
    Serial.println("Error (Not-A-Number) when trying to read humidity and temperature.");
  } else {
    Serial.print(rh); Serial.println(" %RH");
    Serial.print(temp); Serial.println(" ˚C");
  }

  delay(2000);
}

You can find more usages examples in examples/.

Acknowledgments

  • Eduardo Gomez (Professor. Head of "Robotics and Automation" subject).
  • Luciano Yurquina (Testing and Research).

References

About

DHT sensor library for Arduino.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages