How to connect dht 11 to lcd using arduino uno

my lcd can’t work if I use blynktimer
can i use dht11 without blynktimer or how can i connect dht11 with lcd
sorry i’m still a beginner about blynk :pensive:

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <DHT.h>

char auth[] = "ekwNowGzrnSW1NDrYG70wXlpAnbLus2L";
char ssid[] = "Block-A";
char pass[] = "blocka123";

#include <SoftwareSerial.h>
SoftwareSerial EspSerial(3, 4); // RX, TX
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
#define DHTPIN 2       
#define DHTTYPE DHT11     // DHT 11

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); 

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

void setup()
{
  
  Serial.begin(9600);
  EspSerial.begin(ESP8266_BAUD);
  delay(10);
  Blynk.begin(auth, wifi, ssid, pass);
  dht.begin();
 /timer.setInterval(1000L, sendSensor);
}

void loop()
{
  
  Blynk.run();
  timer.run();
}

this code with lcd but it not working

#include <DHT.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <DHT.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
 
int redLed = 10;
int buzzer = 8;
int smokeA0 = A0;
int sensorThres = 70;   

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

char auth[] = "ekwNowGzrnSW1NDrYG70wXlpAnbLus2L";
char ssid[] = "Block-A";
char pass[] = "blocka123";

#include <SoftwareSerial.h>
SoftwareSerial EspSerial(3, 4); 
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
#define DHTPIN 2       
#define DHTTYPE DHT11 

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); 

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}
void setup()
{

  lcd.init();                
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("connecting...");
  
  pinMode(redLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);

  Serial.begin(9600);
  delay(10);
  EspSerial.begin(ESP8266_BAUD);
  delay(10);
  Blynk.begin(auth, wifi, ssid, pass);
}

void loop()
{
  
  int analogSensor = analogRead(smokeA0);
  lcd.print("API:");
  lcd.print(analogSensor);
  if (analogSensor > sensorThres)
  {
    digitalWrite(redLed, HIGH);
    lcd.setCursor(1, 1);
    lcd.print("Alert....!!!");
    digitalWrite(12, LOW);
    tone(buzzer, 1000, 200);
  }
  else
  {
    digitalWrite(redLed, LOW);
    digitalWrite(12, HIGH);
    lcd.setCursor(1, 1);
    lcd.print("....Normal....");
    noTone(buzzer);
  }
  delay(500);
  lcd.clear();
  
  Blynk.run();
}

First of all, you need to read this…

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/keep-your-void-loop-clean

Secondly, it would really help if you defined what…

actually means in practice.
Is the code failing to compile, failing to connect to the Blynk server, failing to display the correct data in Blynk, failing to display any data in Blynk, failing to display the correct data on the LCD, failing to display any data on the LCD, something else, or a combination of these issues?

We aren’t psychic, and unless we happen to have exactly the same hardware to hand, and feel like taking the time to assemble it, upload your sketch and observe the results then we are reliant on you to provide the relevant information.
When you take your car in for a service do you say “there’s something wrong with it”, but leave it up to the mechanic to decide what that is and fix it?

Pete.

ohh…Forgive me for being insensitive
my lcd is not print what it is supposed to print
it print only “connecting…”

i have read the web that you give
but i have a question, is void sendSensor same as void sensorDataSend

It’s not a cut and paste example, it’s an article about the principals of writing code that works correctly with Blynk.

Pete.

ohh. sorry