Iduino nano - Display LCD i2c

I have LCD i2c and IDUINO nano v3,0 and the programmer is UBStinyISP from them tools. First, I would like to make the lcd i2c show "hello world". Although I used this code that I found on the internet, it doesn't even work. Does anyone know any other right code to make this work? Thank you!

//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

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

void setup()
{
lcd.init(); // initialize the lcd
// 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()
{
}

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.

It might just be that the address is wrong: mine's 27.

Did you verify that address with an I2C scanner?

neiklot:
It might just be that the address is wrong: mine's 27.

Did you verify that address with an I2C scanner?

That would of course, be an automatic part of the much more capable HD44780 library.

Paul__B:
That would of course, be an automatic part of the much more capable HD44780 library.

Yes, but might be a quicker test of the lcd's functionality than installing a new library.

neiklot:
Yes, but might be a quicker test of the lcd's functionality than installing a new library.

But the I2C scanner won't help with determining anything about the LCD pin mapping ....

Don

floresta:
But the I2C scanner won't help with determining anything about the LCD pin mapping ....

Of course not, but if it can find the address and OP can then use that address instead of 3F it might work.

If not, no harm done and use bperrybaps' library obviously.

neiklot:
Of course not, but if it can find the address and OP can then use that address instead of 3F it might work.

If not, no harm done and use bperrybaps' library obviously.

I hope you realize that 0x27 and 0x3F are only 2 of the 16 possible addresses and only 2 of the 4 most likely ones.

Don