I can't get the I2C LCD to work

Hi everyone. I'm having an annoying problem with the 1602A I2C LCD screen. I connected the GND to the GND of arduino (Mega) the VCC to the 5V, SDA to the A4 and SCC to the A5.
Scanning through <i2cdetect.h> I don't read any addresses or signs of life. Can someone help me?
Thank you

Arduino mega

Mega2560: 20 (SDA), 21 (SCL)

have you tried example sketch here? Serial I2C LCD 1602 Module (HCARDU0023) - forum.hobbycomponents.com

+1 for what @ruilviana said. The I2C pins in the Mega are different than Uno or Nano.

Have you tried the contrast adjustment?

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.

To 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 menus, 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.

If by that you mean you see absolutely nothing on the display, then the first thing to adjust is in fact, the contrast potentiometer until you see a row of "blocks" on the upper row.

But the SDA and SCL pins on a Mega are not A4 and A5.

I had the wrong pins as I was using the Mega256. I feel stupid :slight_smile:

Ref: Cannot figure why my code ignores the second for()) - #9 by anon87005993
Don't... everyone made and still makes errors like that; we're human.

243-Adesivo-Eu-nao-sou-um-robo-Nerd-Stickers