#include "DHT.h"

#define DHT1_PIN 2 
#define DHT2_PIN 3    
#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321

DHT dht1(DHT1_PIN, DHTTYPE);
DHT dht2(DHT2_PIN, DHTTYPE);

void setup() {
  Serial.begin(115200);
  Serial.println(F("DHT22 example!"));

  dht1.begin();
  dht2.begin();
}

void loop() {
  float temperature_1 = dht1.readTemperature();
  float humidity_1 = dht1.readHumidity();
  float temperature_2 = dht2.readTemperature();
  float humidity_2 = dht2.readHumidity();

  // Check if any reads failed and exit early (to try again).
  if (isnan(temperature_1) || isnan(humidity_1) || isnan(temperature_2) || isnan(humidity_2)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }
float average = (temperature_1 + temperature_2)/2;
 
  
  Serial.print(temperature_1);
  Serial.println(F("°C "));
  Serial.print(temperature_2);
  Serial.println(F("°C "));
   Serial.println("Average = ");
  Serial.print(average);
 

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