DHT11 sensor together with Liquid crystal I2C display

My SimpleDHT sensor and LCD display are working separately.
But not together.
See my sketch and error messages.
Who can help me?

sketch:
#include <SimpleDHT.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

LiquidCrystal_I2C lcd(0x3F,16,2);
int pinDHT11 = 4;
SimpleDHT11 dht11;
const int DHT11_PIN= 4;

void setup() {
// put your setup code here, to run once:

lcd.begin();
lcd.backlight();
}

void loop()
{
// put your main code here, to run repeatedly:

SimpleDHT.read11(SimpleDHT11_PIN);
lcd.setCursor(0, 0); lcd.print("Temp: "); lcd.print(SimpleDHT.temperature,0);
lcd.print(char(223));
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(DHT.humidity,0); lcd.print(" %");
delay(200);

}

Error messages:

C:\Users\Wim\Documents\Arduino\DHT11_w_LCD_display.ino\DHT11_w_LCD_display.ino.ino: In function 'void loop()':

DHT11_w_LCD_display.ino:22: error: expected unqualified-id before '.' token

SimpleDHT.read11(SimpleDHT11_PIN);

^

DHT11_w_LCD_display.ino:23: error: expected primary-expression before '.' token

lcd.setCursor(0, 0); lcd.print("Temp: "); lcd.print(SimpleDHT.temperature,0);

^

DHT11_w_LCD_display.ino:28: error: 'DHT' was not declared in this scope

lcd.print(DHT.humidity,0); lcd.print(" %");

^

Bibliotheek SimpleDHT op versie 1.0.6 in map: C:\Users\Wim\Documents\Arduino\libraries\SimpleDHT wordt gebruikt
Bibliotheek LiquidCrystal_I2C in map: C:\Users\Wim\Documents\Arduino\libraries\LiquidCrystal_I2C (legacy) wordt gebruikt
Bibliotheek Wire op versie 1.0 in map: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire wordt gebruikt
exit status 1
expected unqualified-id before '.' token

The object that you declare of the SimpleDHT11 class is named dht11. Isn't dht11 what you use when dealing with that instance's variables and functions?

SimpleDHT11_PIN

Where is that declared?

Thanks for your answer.
I dont understand your question.
What would you suggest?
Where can I find the information you ask.
Maybe I could try something you suggest?
thanks alot for answering.
I am totally new but strongly interested.

SimpleDHT11 dht11;  //Create an object named dht11
const int DHT11_PIN= 4;  //declare a variable to hold the number of the pin the DHT is connected to
SimpleDHT.read11(SimpleDHT11_PIN);  //try to read from an object with a different name using a name for the pin that has not been declared

See my comments added to your code above.

SimpleDHT11 dht11;

This line creates an instance of the SimpleDHT11 class named dht11.
A class is like a bunch of thing that are alike. Like a crowd of people. You need an assistant so, from the crowd, you pick one person (an instance of the crowd class). You call him Fred. If you want to know Fred's age you don't ask the crowd, you ask Fred.

SimpleDHT.read11(SimpleDHT11_PIN);

Here you are using the class name not the instance name. And referring to a constant (SimpleDHT11_PIN) that does not exist.

lcd.print(SimpleDHT.temperature,0);

Here you are using the class name not the instance name.

lcd.print(DHT.humidity,0); lcd.print("  %");

Where did DHT come from?

I don't have the library and don't want to hunt it down so can't test the code, but here is your code with the mistakes that I mentioned fixed.

#include <SimpleDHT.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

LiquidCrystal_I2C lcd(0x3F, 16, 2);

// int pinDHT11 = 4; only need one

SimpleDHT11 dht11;
const int DHT11_PIN = 4;

void setup()
{
  lcd.begin();
  lcd.backlight();
}

void loop()
{
  dht11.read11(DHT11_PIN);  // proper instance name and pin constant
  lcd.setCursor(0, 0);
  lcd.print("Temp:       ");
  lcd.print(dht11.temperature, 0); //  proper instance name
  lcd.print(char(223));
  lcd.print("C");
  lcd.setCursor(0, 1);
  lcd.print("Humidity:   ");
  lcd.print(dht11.humidity, 0); lcd.print("  %");  //  proper instance name
  delay(200);  // the humidity sensor is slow.  It won't read this fast.
}

Please read the forum stickies to see how to format and post code.

Fwiw, below is the code I use, but it's not the same library.

It displays the min and max T since power up, along with current T and RH.

It uses two LCD cells to display ". " or " ." as a heartbeat so you can see it's working if the values aren't changing.

Backlight controlled by a button.

The heartbeat and the delay between DHT reads are delay()-less.

// dht11 with lcd
//
//this version diplays min and max T since power up
//lcd backlight is operated by a button
//with pulse and no delay on the dht read

#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 5

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

byte minTemp = 99;
byte maxTemp = 0;
byte currTemp;

byte lightPin = 2;

//pulse stuff
int heartbeatInterval = 1000;
bool showHeart = true;
unsigned long previousMillis_heartbeat = 0;

//delayless dht read
int dhtInterval = 5000;
unsigned long previousMillis_dht = 0;

void setup()
{
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);

  pinMode(lightPin, INPUT_PULLUP);
  lcd.begin();
  lcd.backlight();
  lcd.print("     DHT11");
  lcd.setCursor(0, 1);//along, down
  lcd.print("   station v4");
  delay(2000);
  lcd.noBacklight();
  lcd.clear();

  //need to read once to get some proper data before the delayless reads
  DHT.read(DHT11_PIN);    // READ DATA
}

void loop()
{
  if (millis() - previousMillis_heartbeat > heartbeatInterval)
  {
    doPulse();
  }

  if (!digitalRead(lightPin))
  {
    lcd.backlight();
  }
  else
  {
    lcd.noBacklight();
  }

  //read dht without delay
  if (millis() - previousMillis_dht > dhtInterval)
  {
    DHT.read(DHT11_PIN);    // READ DATA
    previousMillis_dht = millis();
  }

  currTemp = DHT.temperature;
  lcd.setCursor(0, 0); //along, down
  lcd.print("Temp:");
  if (currTemp < 10) lcd.print(" ");
  lcd.print(currTemp);
  lcd.print((char)223); //degree symbol
  lcd.print("C RH:");
  lcd.print(DHT.humidity);
  lcd.print("%");

  if (currTemp < minTemp) minTemp = currTemp;
  if (currTemp > maxTemp) maxTemp = currTemp;
  lcd.setCursor(0, 1);//along, down
  lcd.print("Min:");
  if (minTemp < 10) lcd.print(" ");
  lcd.print(minTemp);
  lcd.print((char)223);
  lcd.setCursor(9, 1);//along, down //jump over pulse indicator
  lcd.print("Max:");
  if (maxTemp < 10) lcd.print(" ");
  lcd.print(maxTemp);
  lcd.print((char)223);

}

void doPulse()
{
  showHeart = !showHeart;
  previousMillis_heartbeat = millis();

  lcd.setCursor(7, 1);
  if (showHeart)
  {
    lcd.print(". ");
  }
  else
  {
    lcd.print(" .");
  }
} //doPulse

Thanks for the answers.
I think I make progression.
I Used the sketch you proposed.
Bur I still get an error message:

Bibliotheek SimpleDHT op versie 1.0.6 in map: C:\Users\Wim\Documents\Arduino\libraries\SimpleDHT wordt gebruikt
Bibliotheek LiquidCrystal_I2C in map: C:\Users\Wim\Documents\Arduino\libraries\LiquidCrystal_I2C (legacy) wordt gebruikt
Bibliotheek Wire op versie 1.0 in map: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire wordt gebruikt
exit status 1
'class SimpleDHT11' has no member named 'read11'

May be I use a wrong librarie?

The sketch code is used: in the attachment.

DHT11_w_LCD_display.ino.ino (684 Bytes)

Post your code that produces that error.

Here is the code:

#include <SimpleDHT.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

int pinDHT11=2;
SimpleDHT11 dht11;
LiquidCrystal_I2C lcd(0x3F, 16, 2);

void setup()
{
lcd.begin();
lcd.backlight();
}

void loop()
{
dht11. read(pinDHT11); // proper instance name and pin constant
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(dht11.temperature, 0); // proper instance name
lcd.print(char(223));
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(dht11.humidity, 0); lcd.print(" %"); // proper instance name
delay(200); // the humidity sensor is slow. It won't read this fast.
}

May be I use a wrong librarie?

Could be. Where did you get the library? Did the library come with examples? Most do.