#include "DHT.h"

// Constants
#define DHTTYPE DHT22   // DHT 22 (AM2302)

// Pin definitions
const int DHTPins[] = {2, 3, 4, 5, 6, 7};

// Create DHT sensor objects
DHT dhtSensors[6] = {
  DHT(DHTPins[0], DHTTYPE),
  DHT(DHTPins[1], DHTTYPE),
  DHT(DHTPins[2], DHTTYPE),
  DHT(DHTPins[3], DHTTYPE),
  DHT(DHTPins[4], DHTTYPE),
  DHT(DHTPins[5], DHTTYPE)
};

void setup() {
  Serial.begin(9600);
  Serial.println("DHT22 Multiple Sensors Test");

  // Initialize each DHT sensor
  for (int i = 0; i < 6; i++) {
    dhtSensors[i].begin();
  }
}

void loop() {
  for (int i = 0; i < 6; i++) {
    // Read temperature as Celsius
    float temp = dhtSensors[i].readTemperature();
    // Read humidity
    float humidity = dhtSensors[i].readHumidity();

    // Check if any reads failed and exit early (to try again).
    if (isnan(temp) || isnan(humidity)) {
      Serial.print("Failed to read from DHT sensor at pin ");
      Serial.println(DHTPins[i]);
      return;
    }

    // Print the results to the Serial Monitor
    Serial.print("Sensor ");
    Serial.print(i+1);
    Serial.print(" - Temperature: ");
    Serial.print(temp);
    Serial.print("°C ");
    Serial.print(" Humidity: ");
    Serial.print(humidity);
    Serial.println("%");
  }

  // Wait a few seconds between measurements.
  delay(2000);
}

$abcdeabcde151015202530354045505560fghijfghij