Using LiquidCrystal_I2C.h and other libraries, many compile errors, very odd...

I'm trying to run a few examples after installing Ver 1.8.5 and updating a few libraries.

When I run the Hello World example, only an 'H' displays.
Coincidentally, only the first character displays of a Clock sketch also.

The 16x2 LCD module displayed all data using Ver 1.0.5, with an older library.

Any thoughts?

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

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

void setup()
{
  lcd.init();                      // initialize the lcd 
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
}

and updating a few libraries.

Did you update LiquidCrystal_I2C.h?

AFIK, The bug has been fixed.

Make sure that you only have one library with the name LiquidCrystal_I2C .

The github link you posted does show the correct treatment of the return value from the code at line 206-208.

inline size_t LiquidCrystal_I2C::write(uint8_t value) {
	send(value, Rs);
	return 1;
}

Ok
The Github version had a Wire.h not found error.

This one:
http://www.archiduino.com/wp-content/uploads/2016/03/LiquidCrystal_I2C.zip

Has the same one character problem, with the backlight not coming on.

I'm thinking my fresh install of Ver 1.8.5 did not install the full libraries.

Use the library manager.

I have started a new sketch from scratch with only a couple libraries, and it seems that the LiquidCrystal_I2C.h can't be used.

I have updated LiquidCrystal_I2C.h in library manager to version 1.1.2.

My code:

#include <Wire.h>
#include "RTClib.h"
#include <Time.h>
#include <LiquidCrystal_I2C.h>

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

Compile errors:
Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"

In file included from C:\Users\Stu\Documents\Arduino\RTC_Sync_16x2\RTC_Sync_16x2.ino:8:0:

C:\Users\Stu\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:81:16: error: conflicting return type specified for 'virtual void LiquidCrystal_I2C::write(uint8_t)'

virtual void write(uint8_t);

^
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,

from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:232,

from sketch\RTC_Sync_16x2.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:51:20: error: overriding 'virtual size_t Print::write(uint8_t)'

virtual size_t write(uint8_t) = 0;

^

Multiple libraries were found for "RTClib.h"
Used: C:\Users\Stu\Documents\Arduino\libraries\RTClib
Not used: C:\Users\Stu\Documents\Arduino\libraries\z_RTClib
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\Stu\Documents\Arduino\libraries\LiquidCrystal_I2C

I don't confirm your experience. I downloaded the library from the library manager, and can run the library examples. You may be seeing some warnings, but the library does function with the YRobot lcd. The original program you posted runs for me with the 1.1.2 version from the library manager and ide v1.8.5 and prints the full "Hello World".

Multiple libraries were found for "LiquidCrystal_I2C.h"

The multiple libraries situation is not good. Are you sure which one is being used?

The LiquidCrystal_I2C.h library will not work with all the possible versions of i2c backpacks without modification because there is no standard relationship of the pins on the chip to the pins of the lcd.

I would suggest that you migrate to a new library which is "plug and play" with all known versions of the i2c backpack for the hd44780 controllers. The library is by Bill Perry, and is called hd44780. It is available through the library manager. It has resolved most of the issues of people getting going with i2c lcd displays and has been thoroughly reviewed in the Displays section of the forum.

You can also get it from GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library

After you have the library installed, try this sketch

#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h> // include i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config display for hd44780 chip

void setup()
{
 // initialize LCD with number of columns and rows:
 lcd.begin(16, 2);

 // Print a message to the LCD
 lcd.print("Hello, World!");
}

void loop()
{
 lcd.setCursor(0, 1);
 lcd.print(millis() / 1000);
 delay(1000);
}

If this does not get you going, run the diagnostic sketch in the library examples.

hd44780\examples\ioClass\hd44780_I2Cexp\I2CexpDiag

Post the results of this diagnostic test if there are problems.

I have resolved this.

A fresh library install from here:

cattledog:
Make sure that you only have one library with the name LiquidCrystal_I2C .

The github link you posted does show the correct treatment of the return value from the code at line 206-208.

inline size_t LiquidCrystal_I2C::write(uint8_t value) {
send(value, Rs);
return 1;

}

As a very old electronics technician and microcontrollers programmer this library for liquid Crystal
I2C diplays are an insult to Arduino users. every time that I have to compile and run the lcds in I2C the library fails. Then, I have to go to download a new or different version and the trouble starts again. Why the Arduino web site does not have an official library for this important phase of the Arduino IDE???

PedroVazquezCasta:
Why the Arduino web site does not have an official library for this important phase of the Arduino IDE???

Probably because no official Arduino has a LCD display?

I get the feeling your post is an insult. Where is your perfect I2C LCD library?

Hi, no official arduino has an LCD????
Well most all of the projects needs an LCD... This is by no means an excuse to not have a library for i2c display backpacks.

Is this a good option? I've been using this with not problems with the cheap ebay lcd backpacks (standard address 0x27)

https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/

and an easy table of all available addresses for the i2c backpack:

Thanks :slight_smile:

screenshot-6_3.png

Hi

Can i humbly suggest you have a look at Bill Perry's hd44780 library.

It is supported in the IDE library manager thus updates are automatically flagged.

It will automatically detect the I2C address of your LCD display. I've had no problems using a variety of 16x2 and 20x4 displays from a number of sources.

Bill has done a pretty decent job of documenting and providing numerous examples.

Bill posts on the forums here. A post with the title "hd44780 library problem" will probably attract his attention.

Hope this helps

Ian

Ashton:
I'm trying to run a few examples after installing Ver 1.8.5 and updating a few libraries.

When I run the Hello World example, only an 'H' displays.
Coincidentally, only the first character displays of a Clock sketch also.

The 16x2 LCD module displayed all data using Ver 1.0.5, with an older library.

Any thoughts?

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

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

void setup()
{
 lcd.init();                      // initialize the lcd

// Print a message to the LCD.
 lcd.backlight();
 lcd.print("Hello, world!");
}

void loop()
{
}

Well, at least I studied this problem verey hard, and has found that the code you have here can work even if you have many LiquidCrystal_I2C libraries. And, this serves as a nice core for using the LCD displays. Also, you can put the lcd.print() commands in the loop() to make the code more firm in the display. Nice code, congratulations!