Initialize components:
Initialize the DHT22 sensor.
Initialize the LCD with I2C communication.
Start serial communication at 9600 baud rate.
Set up LCD display:
Turn on the LCD backlight.
Display "Temp: " at the top row, first column.
Display "Humidity: " at the second row, first column.
Main loop (Repeats continuously):
Delay for 2 seconds to allow sensor readings to stabilize.
Read data from the DHT22 sensor:
Store the temperature in variable tmp.
Store the humidity in variable hum.
Check if readings are valid:
If the temperature or humidity readings are NaN (Not a Number):
Print "Error reading data" on the LCD.
Print an error message on the serial monitor.
Skip further execution for this loop iteration.
Check weather conditions:
If temperature > 20°C and humidity < 85%:
Display the message "Temperature is high" on the LCD.
Print "Temperature is high" to the serial monitor.
If humidity > 85% and temperature > 0°C:
Display "Rain Possible" on the LCD.
Print "Possible Rain" to the serial monitor.
If humidity > 85% and temperature ≤ 0°C:
Display "Snow Possible" on the LCD.
Print "Possible Snow" to the serial monitor.
Update temperature and humidity on the LCD:
Display the current temperature on the LCD after the label "Temp: ".
Display the current humidity on the LCD after the label "Humidity: ".
Repeat:
Go back to step 3 and repeat indefinitely.