LCD: IIC/I2C/TWI 1602 (Doesn't want to display anything.)

Hi!

So the problem is that the LCD is lights up but it is nothing ˝written˝on display.
I'm pretty sure that I don't use the code properly, but I don't know what is wrong so I would like to ask for some help.

Arduino mega 2560
LCd IIC/I2C/TWI 1602 16X2
http://www.ebay.com/itm/251471058918?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

It is connected: GND-GND, 5V-VCC, SDA-SDA(DI20), SCL-SCL(D21)

I'm using library: https://bitbucket.org/fmalpartida/new-liquidcrystal

/*
** Example Arduino sketch for SainSmart I2C LCD2004 adapter for HD44780 LCD screens
** Readily found on eBay or http://www.sainsmart.com/ 
** The LCD2004 module appears to be identical to one marketed by YwRobot
**
** Address pins 0,1 & 2 are all permenantly tied high so the address is fixed at 0x27
**
** Written for and tested with Arduino 1.0
** This example uses F Malpartida's NewLiquidCrystal library. Obtain from:
** https://bitbucket.org/fmalpartida/new-liquidcrystal 
**
** Edward Comer
** LICENSE: GNU General Public License, version 3 (GPL-3.0)
**
** NOTE: TEsted on Arduino NANO whose I2C pins are A4==SDA, A5==SCL
*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR 0x27  // Define I2C Address where the PCF8574A is
#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;

LiquidCrystal_I2C	lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
  lcd.begin (16,2);
  
// Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home ();                   // go home

  lcd.print("SainSmart I2C tester");  
  lcd.setCursor ( 0, 1 );        // go to the 2nd line
  lcd.print("F Malpartida library");
  lcd.setCursor ( 0, 2 );        // go to the third line
  lcd.print("Test & demonstration");
  lcd.setCursor ( 0, 3 );        // go to the fourth line
  lcd.print("Iteration No: ");
}

void loop()
{
  // Backlight on/off every 3 seconds
  lcd.setCursor (14,3);        // go col 14 of line 3
  lcd.print(n++,DEC);
  lcd.setBacklight(LOW);      // Backlight off
  delay(3000);
  lcd.setBacklight(HIGH);     // Backlight on
  delay(3000);
}

Thanks a lot!
Jonathan

Make sure that you have followed the instructions for using the library.

Specifically the original LiquidCrystal library should be removed since this one is a replacement, not an enhancement.

Don

floresta:
Specifically the original LiquidCrystal library should be removed since this one is a replacement, not an enhancement.

Yes, it is in fact a replacement which absolutely is a complete and critically essential enhancement.

{The problem is, why it has not automatically been incorporated into the IDE distribution. :astonished: }

The answer is incredibly simple. NIH

Don

Which leads on to Wirth's law as so dramatically exemplified by Windoze.

But yes, that is pretty clearly the situation.

I'm an idiot!
I didn't know that I have to set contrast on the backside with screwdriver. (Oh dear.....)

Thanks anyway for your help.