Lcd I2C does not display text

So yea, the lcd I2C panel does not display anything . I wanted the LCD to display the humidity, temperature and humidity of the soil, but it does not display anything. There may be something in the code or in hardware but I've checked everything and I still do not know what it can be. I can not program too much so this code is made up of 3 different, so it's very likely that it's something in the code.
Sorry for my English

int woda  = 8; 
int soilPin = A0;//Declare a variable for the soil moisture sensor
int val; //This variable stores the value received from Soil moisture sensor.
int soilPower = 7;//Variable for Soil moisture Power


#include <dht.h>
#include <Wire.h>
#include <LCD.h>
#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(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
dht DHT; //Declaring the DHT as a dht type to use it later

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



void setup() {
  pinMode(8, OUTPUT); //Set pin 8 as OUTPUT pin, to send signal to relay
  pinMode(0, INPUT); //Set pin 0 as input pin, to receive data from Soil moisture sensor.
  pinMode(soilPower, OUTPUT);
  digitalWrite(soilPower, LOW);
  {
 Serial.begin(9600);
  lcd.begin (16, 2);
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home ();

  }
}

void loop() {

}
//This is a function used to get the soil moisture content
int readSoil()
{
  digitalWrite(soilPower, HIGH);//turn D7 "On"
  delay(10);//wait 10 milliseconds
  val = analogRead(soilPin);//Read the SIG value form sensor

  digitalWrite(soilPower, LOW);//turn D7 "Off"
  return val;//send current moisture value
{
  lcd.clear();
  
  lcd.setCursor(0, 0);
  
  int chk = DHT.read11(DHT11_PIN); //Reading data from the module
  
  lcd.print("Tmp:");
  
  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(6, 0);
  lcd.print("Wil:");
  lcd.println(DHT.humidity); //Showing humidity percentage
  lcd.print("%");
  lcd.setCursor(6, 1);
  lcd.print("Glb:");
  lcd.println(DHT.humidity); //Showing humidity percentage
  lcd.print("%");
  delay(1000);//refreshing every 0.5s
}
{if (readSoil() > 600) {
    Serial.println("wetSoil");
    lcd.setCursor(0, 1);
    lcd.print("Wilg");
    delay(500);
  }
  else {
    lcd.setCursor(0, 1);
    lcd.print("Such");
    Serial.println("drySoil");
  }
  Serial.print("Soil Moisture = "); //get soil moisture value from the function below and print it
  Serial.println(readSoil());
  //This 1 second time frame is used so you can test the sensor and see it change in real-time.
  //For in-plant applications, you will want to take readings much less frequently.
  delay(1000);//take a reading every second
}
}

For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.

Install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack (the thing attached to the LCD pin site) to LCD pin mapping.

Ruskichleb:
So yea, the LCD I2C panel does not display anything.

Nice to see you understand how to post your code properly - perhaps you actually read the instructions first - that would actually be rather unusual here! :grinning:

OK, first problem, explain what "the LCD I2C panel does not display anything" means? :roll_eyes:

What panel is it? From where did you get it?

Does it have a backlight? Is the backlight on? If not there is a problem with your power connections.

Got the backlight on? OK, what is on the display? Have you set the contrast potentiometer?

When (and only when) you answer these, we can proceed.

"When (and only when) you answer these, we can proceed."

One more thing.

Do your LCD troubleshooting with a simple program, one that displays a message in setup() and does nothing in loop().

Don