
The project requires the 'DHT' library for the DHT11 sensor and the 'LiquidCrystal_I2C' library for the I2C LCD display.
arduino code:
#define DHTPIN 2
#define DHTTYPE DHT11
#define LCD_ADDRESS 0x27 DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(LCD_ADDRESS, 16, 2);
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
dht.begin();
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(humidity);
lcd.print("%");
delay(1000);
}
No downloadable resources added yet.

Please login to leave a comment.
No comments yet. Be the first to share your thoughts!