please help me with my i2c

i have connected my lcd with i2c ( it labled mh) . I have installed libraries but when i upload it nothing write on my lcd . It’s just a dark line in the lcd nothing happen . Please help me . I have searched for the solution on google some said the address was wrong then i changed it and try it again but nothing happen . here is the code .

#include <Wire.h>;
#include <LiquidCrystal_I2C.h>;
LiquidCrystal_I2C lcd(0x27,16,2);
//0x27 là địa chỉ màn hình trong bus I2C. Phần này chúng ta không cần phải quá bận tâm vì hầu hết màn hình (20x4,...) đều như thế này!
//16 là số cột của màn hình (nếu dùng loại màn hình 20x4) thì thay bằng 20
//2 là số dòng của màn hình (nếu dùng loại màn hình 20x4) thì thay bằng 4
byte traitim[8]={
  B01010,
  B11111,
  B11111,
  B01110,
  B00100,
  B00000,
  B00000,
  B00000
}; // Cái này là tạo hình trái tim...đoạn này tham khảo của Thạc Sĩ Huỳnh Minh Phú đó các bạn
void setup(){
lcd.init();       //Khởi động màn hình. Bắt đầu cho phép Arduino sử dụng màn hình
lcd.backlight();   //Bật đèn nền
}
void loop()
{
  lcd.setCursor(3,0);
  lcd.print("Anh Yeu Em");//Viết dòng chữ Anh Yêu Em...Các bạn có thể thay bằng dòng khác như Minh Thich Cau...
  int i;
  // Viết liên tục các ký tự trái tim ở dòng 2
  for (i=0;i<=10;i++){
  lcd.setCursor(i,1);
  delay(200);  
  }
  delay(2000);
  lcd.clear();//Xóa màn hình
  delay(300);
}

And this is the link of the code Tỏ tình theo phong cách Arduino và I2C LCD | Cộng đồng Arduino Việt Nam

I would suggest that you use my hd44780 library package.
It can be quickly and easily installed using the IDE library manager.
It will auto detect the i2c address and the pin mapping used on the backpack.
You can read more about it here:GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library
Use the IDE library manager to install the library vs doing a zip install or a manual install.
Not only is using the library manager easier and faster but it will ensure that the latest tested library is properly installed.

The library package includes support for several different i/o interfaces.
Each i/o interface has its own i/o class.
The i/o class that you will want to use for your backpack is hd44780_I2Cexp.
The library package includes a diagnostic sketch called I2CexpDiag that will test your i2c signals and then test the memory inside the LCD module.
It is useful to first run this sketch to verify that the library is properly talking to your backpack and LCD module.
Read the instructions in the sketch for how to run it and what to expect on the serial monitor.

After running the diagnostic sketch, you can run and look at other sketches for the hd44780_I2Cexp i/o class like the HelloWorld sketch to see what header files need to be included and how to declare the lcd object.

--- bill

I copied your sketch to run it with my own I2C 20x4 LCD (address 0x3F) and it worked fine when two lines were replaced::

--- LiquidCrystal_I2C lcd(0x27,16,2); was replaced by LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

---lcd.init(); //Khởi động màn hình. Bắt đầu cho phép Arduino sử dụng màn hình was replaced by lcd.begin(16,4);

and the LCD displayed "Anh Yeu Em" !

Success!

photoncatcher:
I copied your sketch to run it with my own I2C 20x4 LCD (address 0x3F) and it worked fine when two lines were replaced::

--- LiquidCrystal_I2C lcd(0x27,16,2); was replaced by LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

---lcd.init(); //Khởi động màn hình. Bắt đầu cho phép Arduino sử dụng màn hình was replaced by lcd.begin(16,4);

and the LCD displayed "Anh Yeu Em" !

Success!

That means you are using a different "LiquidCrystal_I2C" library than ss8335.
There are many different LiquidCrystal_I2C "libraries" out there and that creates lots of confusion and issues.
They are different and don't work the same. They have different capabilities, slightly different APIs, declare their lcd objects differently, and initialize slightly differently.
And unfortunately they all have the same name.

While what you have done works with the library you are using, it is very unlikely to work with the library ss8335 is using. Also, there is the issue of backpack pin mappings. Not all backpacks wire up the PCF8574 output port pins to the LCD in the same way. Most libraries hard code the pin mappings, some, like the library you are using, allow configuring the pin mappings in the lcd constructor.
If the pin mappings used by the library do not match the specific backpack being used, it will not work.
So even if ss8335 switched to the library you are using, there is no guarantee that the pin mappings you are using will work with his backpack since his backpack may or may not be using the same pin mappings.

All these issues, is why I created hd44780. It can self configure itself which makes things much simpler.
The goal of the hd44780 library hd44780_I2Cexp class was to provide a plug and play - "it just works" solution for lcds that use i2c backpacks.
For nearly all the lcd backpacks out there, it achieves that goal.

--- bill

yes, I used Francisco Malpartido's NewLiquidCrystal library
( https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads )
Cheers

Hi Bill,

I located, downloaded and installed Bill Perry’s HD44780 liibrary and ran the library example sketch with special characters on my 20x4 HD44780 compliant LCD display (a 2004A). This is a cheap Chinese LCD display with the usual 16 pins serial interface, via a breadboard with an i2c expander connected with A4 and A5 of my Uno. Works!

You seemed surprised that it works.
My goal and reason for creating the hd44780 library was to create an easy to install library (installs with IDE library manager). And for i2c backpacks I wanted it to be easy to use, and "just work", out of the box without users having to mess with any configuration.
You can even swap out lcd devices and it will still "just work" even if the i2c address is different, pin mappings are different, or backlight control is different AND you don't have to recompile the code. Just reset it and the code figures out the configuration again.

Just to be clear, with the hd44780 library, you don't really have to locate or download the library manually yourself. It is recommended to install it directly from the IDE gui using the library manager.
The library manager will download the library and install it for you.

Hi Bill,
I am always surprised with computers when things (finally) work. Electronic devices do not always what they are supposed to do. My old laser printer is not recognized by Windows 7 and 10, My Ipad freezes every now and then. What about the ‘click of death’ with good old zip disks?
I stuck several (two years old) standard parallel 16x2 and 20x4 HD44780 LCD displays together with a standalone I2C backpack on a breadboard and tested them with a sketch including the 44870hd library. Worked!
Cheers.

photoncatcher:
Hi Bill,
I am always surprised with computers when things (finally) work. Electronic devices do not always what they are supposed to do.

Actually devices (hardware) almost always works the way the way it is supposed to.
The problem is that more and more is being done by s/w (things that traditionally were done by h/w) and there are too many people out there writing s/w that need to stay away from s/w and find alternate careers or hobbies.
The younger/new generation of s/w developers are often clueless about standard development practices and often just toss their crappy s/w out the door way before it is ready and they often seldom do much testing.

--- bill