#include <DHT.h>
#include <Servo.h>

#define DHTPIN 2     
#define DHTTYPE DHT22
#define LEDPIN 7    
#define SERVOPIN 9   
#define RELAYPIN 8   

DHT dht(DHTPIN, DHTTYPE);
Servo myServo;

void setup() {
  Serial.begin(9600);
  dht.begin();
  pinMode(LEDPIN, OUTPUT);
  pinMode(RELAYPIN, OUTPUT);
  myServo.attach(SERVOPIN);
  myServo.write(0);  
}

void loop() {
  int temp = dht.readTemperature();
  
  // Check if reading failed
  if (isnan(temp)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Serial.print("Temperature: ");
  Serial.print(temp);
  Serial.println(" *C");

  if (temp > 25) {
    digitalWrite(RELAYPIN, HIGH); 
    myServo.write(90);            
    digitalWrite(LEDPIN, LOW); 
  } else {
    digitalWrite(RELAYPIN, LOW);  
    myServo.write(0);             
    digitalWrite(LEDPIN, HIGH);  
  }
  
  delay(2000); 
}
NOCOMNCVCCGNDINLED1PWRRelay Module