#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#include <Servo.h>
Servo servo;
LiquidCrystal_I2C lcd(0x27, 16, 2); // Adjust the I2C address if needed
DHT dht(2, DHT11); // Use the appropriate pin and sensor type
void setup() {
servo.attach(9); // Attach the servo to pin 9
lcd.init();
lcd.backlight();
dht.begin();
}
void loop() {
// Read temperature from the DHT sensor
float temperature = dht.readTemperature();
// Display temperature on the LCD
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print("C");
// Control the servo and LED based on temperature
if (temperature > 25.0) {
servo.write(90); // Move the servo to 90 degrees
digitalWrite(7, HIGH); // Turn on the LED
} else {
servo.write(0); // Move the servo to 0 degrees
digitalWrite(7, LOW); // Turn off the LED
}
delay(1000); // Delay for one second between readings
}