Lilypad USB with LCD I2C

Hi everyone :slight_smile: !

I’m new with arduinos and I started a little project with a LilyPad Arduino USB - ATmega32U4 Board, the goal is to have an I2C LCD screen connected to display some text.
The problem is that the LCD screen doesn’t display any text and I don’t know why.

Here are the pinouts of the lilypad, I bound SDA and SCL as it is shown on the picture above : SDA to 2 and SCL to 3, VCC to + and GND to -.

https://www.google.com/search?q=lilypad+usb+pinout&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiNwL-G4MfhAhUN2aQKHUKbAFMQ_AUIDigB&biw=1458&bih=710&dpr=1.25#imgrc=pPk95htqRVfGIM

I used the code below to try to make it work, 0x27 is the adress chosen for the LCD screen as it is described in this picture.

https://www.google.com/search?q=i2c+address&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiG4Nj54cfhAhUjMewKHcF7DPkQ_AUIDigB&biw=1458&bih=710#imgrc=M7BM9_I9JXapDM

Here the code I tried that doesn’t work. The backlights are illuminated but there is no text :frowning: .

#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(0,1);
  lcd.print("Hello, world!");


}


void loop()
{
}

If you guys have some idea to help, you are welcome ! Thank you for taking the time to help me :slight_smile: !

Does adjusting the contrast make any difference? Does any thing show on the display? A row of boxes?

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 to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.

Thank you so much :slight_smile: ! I tried the code and it said the adress is x3F so I was wrong ! From that I tried it on my code and it displayed Hello World.

Thank you for helping me !