In general you should load the library files from the same place that you get your I2C adapter. The libraries are not interchangeable even though they have the same names.
Thank you for your reply, floresta.
Yes, just tried that. I got this LCD display (with I2C board installed) from SainSmart (thru Amazon.com).
Just looked at SainSmart's website, the section for this LCD display, its URL is:
http://www.sainsmart.com/sainsmart-iic-i2c-twi-serial-2004-20x4-lcd-module-shield-for-arduino-uno-mega-r3.html
They give links for their code etc. Went to the link and downloaded the latest version of their library.
I found an example of a simple write-to-the-display sketch and compiled it. Naturally, it didn't compile cleanly... but it was close.
The sketch's code is:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27,16,2);
void setup()
{
// initialize the LCD
lcd.begin(20,4,LCD_5x8DOTS);
// Turn on the blacklight and print a message.
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
// Do nothing here...
}
....and the error messages look like:
HelloWorld_test_26Mar2016:5: error: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]
LiquidCrystal_I2C lcd(0x27,16,2);
^
In file included from C:\Users\lilab\HelloWorld_test_26Mar2016\HelloWorld_test_26Mar2016.ino:2:0:
C:\Users\lilab\Documents\Arduino\libraries\NewliquidCrystal/LiquidCrystal_I2C.h:53:4: error: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)' [-fpermissive]
LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);
^
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\lilab\Documents\Arduino\libraries\NewliquidCrystal
Not used: C:\Program Files (x86)\Arduino\libraries\NewliquidCrystal
exit status 1
invalid conversion from 'int' to 't_backlighPol' [-fpermissive]
I don't understand the statement "invalid conversion from 'int' to 't_backlighPol' [-fpermissive]".
Did they define some new data type "t_backlighPol" that isn't compatible with a simple integer? How can I find out what it IS compatible with?
(I tried this code with numbers 0x27, 16 and 2 as it originally came. Also tried it later with 0x3F, 20, and 4 to denote a 20x4 display (which mine was). Same result. I wouldn't think having different numbers like that would cause it to fail during compile time, though perhaps it might fail during run time. But I could never get it to compile in the first place without errors.