Need help with DHT22 sketch writing

Hi all.

I have written a sketch for Arduino UNO R3 + DHT22 + LCD 20x4, i2c.

The DHT is working ok, the serial monitor shows both Temperature & Humidity readings. The problem i have is the LCD screen is showing both values as "0" C & 0.00 % ?? the output for the Fan also works ok when i alter the parameters.

I must be missing something, i have tried many different ways to no avail, can anyone help me please, and put me out of my misery.

I have uploaded my sketch for your perusal.

Ray

#include <DHT.h>
#include <Wire.h> 
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

//Constants

#define DHTPIN 4  // pin DHT is connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
#define Fan 12  // pin Fan is connected to
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino

int maxHum = 60;
int maxTemp = 29;

//ALWAYS USE THIS WITH LCD I2C and Addres 0x27
#define I2C_ADDR 0x27
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

//Variables

int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value


void setup() 

{
  pinMode(Fan, OUTPUT);
  Serial.begin(9600); 
  dht.begin();
  lcd.begin(20,4);
  lcd.clear();
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  
  }

void loop() 
{
 
  delay(2000); // Wait a 2 seconds between measurements

  float h = dht.readHumidity();
  float t = dht.readTemperature(); // Read temperature as Celsius
  
  // Check if any reads failed and exit early (to try again).
  
  if (isnan(h) || isnan(t)) 
  {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  
  if(h > maxHum || t > maxTemp) {
      digitalWrite(Fan, HIGH);
  } else {
     digitalWrite(Fan, LOW); 
  }
  
  Serial.print("Humidity: "); 
  Serial.print(h);
  Serial.print(" %\t");
  Serial.print("Temperature: "); 
  Serial.print(t);
  Serial.println(" *C ");


  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Temp: ");
  lcd.print(temp);
  lcd.print(" ");
  lcd.print((char)223);
  lcd.print("C");
  lcd.setCursor(0,1);
  lcd.print("Hum: ");
  lcd.print(hum);
  lcd.print(" %");
  
  
  delay(2000); //Delay 2 sec.

}

You have different variables for serial and LCD

t != temp
h != hum

Many Thanks, AWOL, I Knew it must be an age thing, something simple, again thanks.

Regards

Ray