This example was based on an Arduino UNO and a kit I purchased from Amazon UK which contained various LCD displays, sadly the instructions were not great and I couldn’t get the LCD working but a bit of digging and I struck gold and managed to get the LCD working. Thanks to the Arduino forums for this one
The LCD was this one SainSmart IIC LCD1602 Module Display For Arduino UNO MEGA R3 *New *
First of all I connected up the VCC and GND and then I connected up the SDA of the LCD to A4 and SCL to A5. This is for an Arduino UNO
Now you need to get the I2C address of your LCD
Each device has an I2C address that it uses to accept commands or send messages.
Load the sketch over at http://arduino.cc/playground/Main/I2cScanner and follow the instructions to use it. By opening up the serial monitor window after you upload the sketch, the Arduino will scan the address range looking for a reply.
Take a note of the address that you have found, its used in the code example below , #define I2C_ADDR 0x3F
https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads – rename the LiquidCrystal library in the Arduino installation libraries and replace with this one.
#define I2C_ADDR 0x3F
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
int n = 1;
// Switch on the backlight
//goto start of 2nd line and display a number updating every second
Here is the LCD in action connected to my Arduino, note I used a sensor shield for connecting wires from the Arduino to the LCD