DHT11 Humidity Sensors issue

I am just getting into Arduino after trying to fix an issue that I had. The main issue that I am running into is pulling values from multiple DHT11s. I am able to pull the value from one sensor fine, however, when I connect multiples (currently using 4), all of the values return the same value, no matter what changes I make to individual sensors. I have attempted to follow several guides that I've seen online, but can't seem to get any of them to work. Any help would be greatly appreciated.!!

I assume the issue is where the floats are defined, but I can't seem to get the code to compile with any changes to this section.

#include <dht.h>

#define dht1 A0
#define dht2 A1
#define dht3 A2
#define dht4 A3
dht DHT;

int fan1 = 4;
int fan2 = 5;
int fan3 = 6;
int fan4 = 7;

void setup()
{
Serial.begin(9600);
delay (500);
Serial.println("DHT11 test!");

pinMode(fan1, OUTPUT);
pinMode(fan2, OUTPUT);
pinMode(fan3, OUTPUT);
pinMode(fan4, OUTPUT);
// pinMode(dht1, INPUT);

}

void loop()
{
DHT.read11(dht1);
DHT.read11(dht2);
DHT.read11(dht3);
DHT.read11(dht4);
float h1 = DHT.humidity;
float t1 = DHT.temperature;
float h2 = DHT.humidity;
float t2 = DHT.temperature;
float h3 = DHT.humidity;
float t3 = DHT.temperature;
float h4 = DHT.humidity;
float t4 = DHT.temperature;

if (isnan(t1) || isnan(h1)) {
Serial.println("Failed to read from DHT #1");
}
else {
Serial.print("Humidity 1: ");
Serial.print(h1);
Serial.print(" %\t");
Serial.print("Temperature 1: ");
Serial.print(t1);
Serial.println(" *C");
}
if (isnan(t2) || isnan(h2)) {
Serial.println("Failed to read from DHT #1");
}
else {
Serial.print("Humidity 2: ");
Serial.print(h2);
Serial.print(" %\t");
Serial.print("Temperature 2: ");
Serial.print(t2);
Serial.println(" *C");
}
if (isnan(t1) || isnan(h1)) {
Serial.println("Failed to read from DHT #1");
}
else {
Serial.print("Humidity 3: ");
Serial.print(h3);
Serial.print(" %\t");
Serial.print("Temperature 3: ");
Serial.print(t3);
Serial.println(" *C");
}
if (isnan(t1) || isnan(h1)) {
Serial.println("Failed to read from DHT #1");
}
else {
Serial.print("Humidity 4: ");
Serial.print(h4);
Serial.print(" %\t");
Serial.print("Temperature 4: ");
Serial.print(t4);
Serial.println(" *C");
}
if(h1 >= 50)
{
analogWrite(fan1,255);
}
else
{
analogWrite(fan1,0);
}
delay(5000);
}

 DHT.read11(dht1);
  DHT.read11(dht2);
  DHT.read11(dht3);
  DHT.read11(dht4);
  float h1 = DHT.humidity;
  float t1 = DHT.temperature;
  float h2 = DHT.humidity;
  float t2 = DHT.temperature;
  float h3 = DHT.humidity;
  float t3 = DHT.temperature;
  float h4 = DHT.humidity;
  float t4 = DHT.temperature;

Read your code. You are reading each sensor, but not getting the data in-between. It does not queue up the data, so you're replacing the data from the first three sensors with the last one before you've read it. Then you read the data from the last sensor four times.

Just reordering the lines in that section will fix it (unless there's something I missed).

 DHT.read11(dht1);
  float h1 = DHT.humidity;
  float t1 = DHT.temperature;
  DHT.read11(dht2);
  float h2 = DHT.humidity;
  float t2 = DHT.temperature;
  DHT.read11(dht3);
  float h3 = DHT.humidity;
  float t3 = DHT.temperature;
  DHT.read11(dht4);
  float h4 = DHT.humidity;
  float t4 = DHT.temperature;

float h1 = DHT.humidity;
float t1 = DHT.temperature;
float h2 = DHT.humidity;
float t2 = DHT.temperature;
float h3 = DHT.humidity;
float t3 = DHT.temperature;
float h4 = DHT.humidity;
float t4 = DHT.temperature;

So . . . . h1 = h2 = h3 = h4 = DHT.humidity

Erm, Im sure Im missing something..... but surely you need to create an instance of dht for each sensor?

eg DHT dht1(A0, DHT11); DHT dht2(A1, DHT11);

The syntax seems funky as well, but i know theres more than one version of the DHT libraries so maybe its down to that?

scrumfled:
Erm, Im sure Im missing something..... but surely you need to create an instance of dht for each sensor?

eg DHT dht1(A0, DHT11); DHT dht2(A1, DHT11);

That's a different version of the library. One version is all pretty-objects, instantiate one for each sensor. The other just gives you a DHT object with a method that takes a pin and reads the sensor on that pin, if there is one. My instinct is that the second one is more flash/ram efficient, but not as graceful.