#include <dht.h>
#define dataPin 8 // defines pin number to whitch the sensor is connected
dht DHT; // creats a DHT object
void setup() {
Serial.begin(9600);
}
void loop() {
// uncomment whatever type sensor you're using (DHT11 or DHT22)!
// int readData = DHT.read11(dataPin); // DHT11
int readData = DHT.read22(dataPin); // DHT22/AM2302
float t = DHT.temperature; // gets the values of the temperature
float h = DHT.humidity; // gets the value of the humidity
//print the results on the serial monitor
Serial.print("Temperature = ");
Serial.print(t);
Serial.print(" ");
Serial.print((char)176); // shows degrees character
Serial.print("C | ");
Serial.print((t * 9.0) / 5.0 + 32.0);
Serial.print(" ");
Serial.print((char)176); // shows degrees character
Serial.println("F "); // shows degrees character
Serial.print("Humidity = ");
Serial.print(h);
Serial.println(" % ");
Serial.println("");
delay(2000); // delay 2 seconds
}