Fixing messed up DHT11 and i²c display code

I need to display the temperature in a cooled space for a school project. This has to be done using an arduino uno and an i²c display. I found a code that supported this layout here: Measure temperature/humidity using DHT11 + LCD i2c + Arduino – SURTR TECHNOLOGY

The way everything is hooked up seems fine. There are some serious flaws to the code though.
Anybody wiling to help me out?

//This code is to use with DHT11 Temperature/humidity sensor with LCD i2c screen
//We measure the values of the temperature and humidity then print them on the screen every second
//Refer to Surtrtech channel on youtube or blogger for more information or how to use the LCD i2c

#include <dht.h> //DHT and LCD libraries
#include <LiquidCrystal_I2C.h>

#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);

dht DHT; //Declaring the DHT as a dht type to use it later

#define DHT11_PIN 7 //Declaring where the DHT signal pin is wired

void setup(){
  Serial.begin(9600);
              lcd.begin (16,2);
            lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
            lcd.setBacklight(HIGH);
            lcd.home ();
}

void loop()
{
  lcd.clear();
  lcd.setCursor(0,0);
  int chk = DHT.read11(DHT11_PIN); //Reading data from the module
  lcd.print("Temp: ");
  lcd.print(DHT.temperature); //Showing temperature value (before that you can do some math to get the temperature in Farnheit)
  lcd.print(" C");
  lcd.setCursor(0,1);
  lcd.print("Humidity: ");
  lcd.println(DHT.humidity); //Showing humidity percentage
  lcd.print(" %");
  delay(1000); //Refreshing every 1s
}

Thanks.

There are some serious flaws to the code though.

So make some serious fixes.

You posted in the Programming section, where one of the requirements is to POST YOUR CODE. You thumbed your nose at the requirement, so don't expect anyone to bend over backwards to help.

I thought that giving the link where you can download the code was enough. But I'll edit it to meet requirements.

Doesn't that library require a DHT.init in setup? Check the example code that comes with the library.

The library that this guy tells you to download doesn't even have examples. I downloaded another DHT library wich does have some examples but DHT.init doesn't seem to be necessary. When you replace the library he tells you to download with the one I downloaded, nothing realy changes. I'm probably better off with trying to find another one that does work because I'm very new to arduino.

I would recommend the DHT library that is in the IDE library manager. That library seems to be widely used in tutorials.

There are some serious flaws to the code though.

Could you give us a more detailed description of what the program is or isn't doing? The above requires more psychic ability than most of us have to get any usable information from.

Ian

That's understandable sorry. I rushed into asking questions way to quickly. Right now I'm trying to get this figured out by myself and if I really can't do this i'l get back to asking questions. Thanks anyway.

I use SimpleDHT-master.zip Library for my DHT22 Sensor, and it works fine. The library supports both DHT22 and DHT11, and it contains examples for both DHT22 and DHT11.