LCD I2C Library issue

Hi all
I'm getting an error when trying to verify the code i'm using to show sensor data on a 16x2 LCD display.

The library zip file i'm using is this:

The error i'm getting is this:

Multiple libraries were found for "LiquidCrystal_I2C.h"

Used: /home/ubuntu/opt/libraries/latest/liquidcrystal_i2c_1_1_2

Not used: /tmp/453802791/custom/NewliquidCrystal

/tmp/453802791/temprelay_average/temprelay_average.ino:11:53: error: 'POSITIVE' was not declared in this scope

/tmp/453802791/temprelay_average/temprelay_average.ino: In function 'void loop()':

/tmp/453802791/temprelay_average/temprelay_average.ino:63:7: error: expected ';' before 'lcd'

THanks in advance.

Are you using the Arduino Web Editor (AKA Arduino Create)?

Which board are you compiling for?

It seems this is a problem the web editor has. When I verify the code on the Desktop App, it works.

That's not exactly correct. The thing with the Arduino Web Editor is it has all 1400+ libraries that are in the Library Manager index pre-installed. The problem that causes is that when you #include a file it makes it much more likely that a file of that name will be found in multiple libraries and the wrong one may be selected. This is what happened in your case this library:


Used: /home/ubuntu/opt/libraries/latest/liquidcrystal_i2c_1_1_2

Is one of those pre-installed libraries.

This library:


Not used: /tmp/453802791/custom/NewliquidCrystal

Is the one you installed.

The same problem would have occurred in the regular Arduino IDE if you had both those libraries installed in the same way but of course you probably wouldn't do that, you'd just install the library you wanted.

There are ways to influence the Web Editor to choose the library you want and someone here might be able to help you with that so if you want that help you should answer my question:

Which board are you compiling for?

Yeah after the Desktop app worked I figure that could be the issue and I was looking for a way of directly modify the library path that is using, although I believe the web editor should have this option. Something like "Ignore non-custom libraries" or "only use these libraries".

I'm compiling for a Uno.
Thanks for all the help

OK, I have a solution for how to use the Newliquidcrystal library with Arduino Web Editor:

  • Download the attached modified library
  • In the Arduino Web Editor, click on the "Libraries" tab
  • Click the import button (looks like an up arrow).
  • If the "NOTE: You can also import your whole Sketchbook!" shows up, click "Import".
  • Select the downloaded file (make sure it's the new one,
  • Click "Open"
  • Wait for the upload of the library to finish.
  • Now for some reason nothing happens for like 5 minutes so you just need to wait.
  • Finally an "Updating library?" dialog will pop up. Click "OK".
  • Wait for the library to be "Imported".
  • At last you'll get a confirmation dialog telling you the library has been updated. Click "OK".
  • Add the following line to your sketch before the #include <Liquidcrystal_I2C.h>:
#include <UseTheNewliquidcrystallibraryDummy.h>

What I did was add an empty .h file to the library with a name that will definitely not be found in any other library. Now when the compilation process reaches the ambiguous #include <Liquidcrystal_I2C.h> it gives preference to the Newliquidcrystal library since the previously included file was found in that library. (737 KB)

That's amazing thinking!!
Thanks a lot for sharing it.

The newLiquidCrystal library is different from any other Arduino library that I've seen.
It was designed to replace the IDE bundled LiquidCrystal library. This is what creates these types of issues.
This library was created many years ago, long before the library manager existed back when all 3rd party libraries were manually installed, even before the IDE had the ability to install a library from a downloaded zip file.
Back then it didn't matter.
newLiquidCrystal does offer the advantage that once put into place any existing sketches that used the LiquidCrystal library will "just work".
Unfortunately, at this point in time, that advantage is now a liability as now newLiquidCrystal cannot ever use the library manager cloud installation (at least not as a replacement for LiquidCrystal), and has issues like the one you are seeing.

Other i2c backpack LCD libraries such as LiquidCrystal_I2C (not be confused with the LiquidCrystal_I2C class from fm's newLiquidCrystal) and hd44780 won't have this type of issue since both of those use header file and class names that are different from any IDE bundled library and are available in the library manager.

--- bill