DHT11 (Coding) fail

What does work? I normally add a lot of Serial.println(); when trying to pinpoint what’s wrong. I’d probably add something like this for the sensors:

void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  Serial.print("Got humidity? - ");
  Serial.println(h);
  Serial.print("Got temp? - ");
  Serial.println(t);

  ...
}

I’m not sure what the DHT returns if the reading is faulty, but if it is a number, isnan() would returns false (=OK) I guess…

As @Gunner mentioned, loosen up the timer. If you are using Adafruit’s library, they don’t allow you to read it faster than once every 2 seconds. If you read it faster, it will return the last reading instead. For this reason it’s kinda stupid of the to have a timer set to 1 second in their example code…

I wrote in another thread that the Arudino libraries seems to be a better choice. I don’t have any DHT sensors so can’t confirm it myself, but take a look at my two posts here: