cant find any Error from my LCD 12C 1602 but its doesn't works

Im using Arduino Mega
12C LCD 1602 Yellow Black light

GND = GND
Vcc =5V
SDA=20
SCL=21

my address : 0x27

Library LiquidCrystal by Frank download from Arduino IDE
My Coding as Below:

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

LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
lcd.init(); // initialize the lcd
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Hello, world!");
lcd.setCursor(2,1);
lcd.print("Ywrobot Arduino!");
lcd.setCursor(0,2);
lcd.print("Arduino LCM IIC 2004");
lcd.setCursor(2,3);
lcd.print("Power By Ec-yuan!");
}
void loop()
{
}

If you search the forum. There are MANY threads like this.

The library you have requires two things to work:

  • It must be told the correct i2c address of the backpack.
  • The backpack must use a particular wiring design between the PCF8574 and the HD44780 LCD.

If either of those is incorrect, it will not work.

If you use my hd44780 library package, the library will automatically determine the i2c address and can automatically determine the pin mappings used on the backpack.

I would recommend that you try the hd44780 library.
It also comes with a diagnostic sketch (I2CexpDiag) to test the library and the LCD h/w.
It is available in the IDE library manager.
The i/o class for that backpack which uses an i2c i/o expander, is hd44780_I2Cexp
You can read more about it on the github web page: GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library
And the included documentation which can be found under the sketches for the library.

Do make sure to take time to read the documentation as it explains how the examples are laid out for each i/o class.

--- bill