#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht( DHTPIN, DHTTYPE);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("DHT XX text!");
dht.begin();
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
float h=dht.readHumidity();
float t=dht.readTemperature();
if(isnan(h) || isnan(t)){
Serial.println("Failed to read from DHT sensor:");
return;
}
Serial.print("Humidity:");
Serial.println(h);
Serial.print("%Temparature:");
Serial.println(t);
}