DHT11 Humidity Sensor

DHT11Sensor1

This sketch requires DHT library.

You can download the library here

https://docs.google.com/file/d/0B4qM0hq-OmC1RHhEcXRNSmZ1YW8/

#include “DHT.h”

DHT dht;

void setup()
{
Serial.begin(9600);
Serial.println();
Serial.println(“Status\tHumidity (%)\tTemperature (C)\t(F)”);

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

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

float humidity = dht.getHumidity();
float temperature = dht.getTemperature();

Serial.print(dht.getStatusString());
Serial.print(“\t”);
Serial.print(humidity, 1);
Serial.print(“\t\t”);
Serial.print(temperature, 1);
Serial.print(“\t\t”);
Serial.println(dht.toFahrenheit(temperature), 1);
}

Advertisements
This entry was posted in Arduino Project. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s