7

I bought a Sainsmart LCD2004 from Amazon to use with my Arduino Uno. I understand that since this LCD uses I2C a new library needs to be downloaded.

From the sainsmart website I dowloaded the LCD 2004 rar http://www.sainsmart.com/arduino/arduino-shields/sainsmart-iic-i2c-twi-serial-2004-20x4-lcd-module-shield-for-arduino-uno-mega-r3.html

When I try to compile the example titled helloworld I get the following error:

In file included from HelloWorld.pde:3: C:\Users\r_yob_000\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:81: error: conflicting return type specified for 'virtual void LiquidCrystal_I2C::write(uint8_t)' C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'

There seems to be a conflict between two functions returning different types.

I've tried searching the issue and found a lot of posts with similar errors. The solution suggested is usually that a new version of the LiquidCrytal_I2C needs to downloaded. Or that one should use Arduino IDE version 1.0

I have downloaded tons of LiquidCrytal_I2C libraries and tried them all on IDE version 1.0 and 1.0.6 and I still get the same error message. I've even tried changing the LiquidCrytal_I2C.h file so that it returns the correct type and still have no luck.

Could I please get some help with this issue.

Thank you very much.

1

I had problems with this library too, until I realized the default library name "LiquidCrystal" conflicts with that of another library, which makes that the files get mixed up. Simply place the files in a different folder (I named mine) "LiquidCrystal_4x20". Solved it for me.

1

I just bought 3 of these that work well with this library LiquidCrystal_I2C2004V1.zip
(License: CC BY-NC 2012 http://www.wikispaces.com/user/view/TerryKing).

When installing this library in Arduino IDE (version 1.6 or later), use menu item Sketch | Include Library | Add .ZIP Library..., navigate to the folder where LiquidCrystal_I2C2004V1.zip was downloaded, and then open the zip file.

Use the I2C address in the example "HelloWorld" supplied with LiquidCrystal_I2C2004V1:

//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  lcd.print("Hello, world!");
  lcd.setCursor(2,1);
  lcd.print("Ywrobot Arduino!");
   lcd.setCursor(0,2);
  lcd.print("Arduino LCM IIC 2004");
   lcd.setCursor(2,3);
  lcd.print("Power By Ec-yuan!");
}


void loop()
{
}

Do not change the other library directory name; this one is compatible with the existing library. Just add it as a contributed library.

  • should have been "Import library" menu extract the zipfile with. – Brent Mesler Nov 16 '14 at 1:15
  • Welcome to "Arduino Stackexchange" you can actually edit your answer using the "edit" button under your answer. – Paul Apr 15 '15 at 8:39
  • Extra paragraph consolidated into answer as suggested by MarkU. Thanks! – Nick Gammon Jan 28 '16 at 6:37
0

You must to upgrade your I2C library.

Here you can find it the last version:
https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/

And move the old one in another folder so you can use this one or after you install this one do like this:

  1. Go in the Arduino\libraries\Newliquidcrystal_1.3.5\
  2. Rename the LiquidCrystal_I2C.h like LiquidCrystal_I2Ca.h
  3. When you use it in the sketch use include LiquidCrystal_I2Ca.h

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy