#include "DHT.h"
#define DHTPIN 2
#define DHTYPE DHT22
DHT dht(DHTPIN,DHTYPE);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
float h =dht.readHumidity();
float t =dht.readTemperature();
float f =dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)){
Serial.println(F ("failed to read from DHT sensor!"));
return;
}
}