Ugh these lcds both i2c and not have been such a headache for me....
ok
//DFRobot.com
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#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
// Print a message to the LCD.
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
}
i realize the 2 r slightly different but it should work as they pin up the same.
backlight is on and i adjusted the contrast i can see white boxes only or nothing with contrast down.
and it mentions the library to use. However, that library has a considerably different constructor call for the display than the one you use even though the library names are the same:
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address*
Try 0x38 Or 0x3F what they say on the the link posted but most 16 2 LCD use 0x38 not 0x27
and you know you need to pullup the SDA and SDC lines with 10 k resistors.
I played with this all day last weekend and my whole problem was I forgot the pullups on the SDA and SDC lines.
Ok but if he checks that's one thing he knows for sure is right.
But I read maybe 20 pages and not one said anything about the 10 k pullups and I found a sch and it showed them for uno. I even know it needed them but I hooked it up as drawn on the library I used no pull ups and then i said this needs pull ups and A4 A5 are the pins I need dang It works LOL
I'll check first OP should too
If it's this LCD then none needed
Can you post a real good picture of the back side of the LCD the Leonardo may use different pins have to look and see if SDA and the SDC are in the same place.
On the side where the tx and rx are not the analog side ..tx and rx is pin one and two you use the next two pins 3 and 4
Pin 3 is data and pin 4 is clock
The mega is SDA on pin 20 and SCL on pin 21.
Arduino Leonardo should have them marked if it's a real Arduino Leonardo But there on pin 3 SDA and pin 4 SCL and On the same side at he end of the second header there there also look at the schematic.