(SOLVED) DHT11+DHT22 project. strange behaviour. Gives "0" readings

Hi all.
I'm triying to make a [forget my complex project] where I measure internal (dht11) and external (dht22) humidity and temperature.

I managed to do it with this code, but It won't work I delete a "Serial.println" (this doesn't make sense to me) i commented it in the code:

#include <dht11.h>
#include <DHT22.h>
//decrlaring dht22, name, pin
DHT22 humext (2);
//name of the dht11
dht11 humint;

void setup()
  //setting the pin for dht11
  Serial.println("DHTxx TEST PROGRAM ");
void loop()

  Serial.print("Humidity (%): ");
  Serial.println((float)humint.humidity, DEC);

  Serial.print("Temperature (°C): ");
  Serial.println((float)humint.temperature, DEC);
  Serial.print("Temperature (°F): ");
  Serial.println(humint.fahrenheit(), DEC);
  //<<-- TO HERE, it won't work
  Serial.println("Temp & % EXTerior");

   Serial.print(" C ");

If I deleted the part between //, dht11 gives me " 0" readings. I don't want fahrenheit values in my project, just celsius :frowning:
I just can't understand it.

Im using Arduino 1.0 and the following libraries:

Thank you very much

Is it the Serial.print() calls that make it work (unlikely) or the call to humint.fahrenheit() that is in the print() statement that makes it work?

Thank you!
Yes, it was the


I don't understand why this line need to be in the code since (I think) fahrenheit is converted from celsius in the library.

I'll investigate it later when I'm more skilled in coding and arduino.

The dht11 class has two methods and two fields. The fields are humidity and temperature. They contain the values from the last time the sensor was read. The two methods are celcius() and fahrenheit(). Each of the methods calls read(), to actually get information from the sensor, and populate the temperature field.

When you commented out the print() of the value returned by fahrenheit(), you caused the read() method to never get called.