void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
#include <Wire.h>
#include <DHT.h>
#define DHT_PIN 2 // Define the pin to which the DHT sensor is connected
#define DHT_TYPE DHT22 // Specify the type of the DHT sensor
DHT dht(DHT_PIN, DHT_TYPE);
LiquidCrystal_I2C lcd(0x3F, 20, 4); // Specify the I2C address (0x3F for most displays)
void setup() {
lcd.begin(20, 4);
lcd.print("Nick Name: YourName"); // Replace "YourName" with your nickname
delay(2000);
}
void loop() {
float temperature = dht.readTemperature(); // Read temperature in Celsius
float humidity = dht.readHumidity(); // Read humidity
lcd.clear();
// Display Nick Name on the first row
lcd.setCursor(0, 0);
lcd.print("Nick Name: YourName"); // Replace "YourName" with your nickname
// Display Temperature on the second row
lcd.setCursor(0, 1);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print(" C");
// Display Humidity on the third row
lcd.setCursor(0, 2);
lcd.print("Humidity: ");
lcd.print(humidity);
lcd.print(" %");
delay(2000); // Adjust the delay based on your requirements
}