What am i doing wrong?

Please see the code below:

#include <LiquidCrystal.h>

#include <LiquidCrystal_I2C.h>

I would like to establish communication between an arduino uno and a 2X16 lcd through I2C.
But IDE will not compile the code "#include <LiquidCrystal_I2C.h>", as you can see the text is black and not orange as the text above.

Sorry, of course you cant see the black and orange text, but the code:

#include <LiquidCrystal.h>
Will compile perfectly fine

And the code:

#include <LiquidCrystal_I2C.h>
Will not be compiled (exit status 1)

i have a 2x16 w/the buttons that connects to a mega as a sheild. uno shouldn't make a difference. i don't include the ...I2C.h header. i use Wire.h. here's some code snippets ... they assume you're interested in using the I2C interface for master/slave communication. if not, disregard and simply use the liquid crystal lib interfaces to display to the lcd.

#include <Wire.h>
#include <LiquidCrystal.h>

// numbers are arbitrary, and these a completely different boards only connected through the
// I2C 2-wire interface
const int I2C_leader_board = 125; // for i2c communication to slave leader board (sda)
const int I2C_caution = 126; // for i2c communication to slave caution (sda)

setup()

//
Wire.begin(); // join i2c bus (address optional for master)

Wire.beginTransmission( I2C_leader_board ); // send event to leader board
int n_bytes = Wire.write( (byte)e_reset ); // send the event number as data
int rc = Wire.endTransmission();
//
if( I2C_trace )
trace_wire_write( "setup():", I2C_leader_board, e_reset, n_bytes, rc );
//
Wire.beginTransmission( I2C_caution ); // send event to caution
n_bytes = Wire.write( (byte)e_reset ); // send the event number as data
rc = Wire.endTransmission();
//
if( I2C_trace )
trace_wire_write( "setup():", I2C_caution, e_reset, n_bytes, rc );

etc, etc, etc ... see wire lib for more interfaces
sda/scl (data/clock) pins on the uno are A4 and A5, sda/scl pins on the display are labelled.

//
lcd.begin( 16, 2 ); // instantiate lcd class
//
lcd.setCursor( 0, 0 );
lcd.print( " text " );
etc,etc,etc

See the examples in the library, i am quite sure that the begin function need different arguments

sorry aster94. you're wrong on both counts. that is, whether you were referring to the write or lcd library.

Mathniel
I have no idea what library leepalmar is referring to or what the code fragment posted does as there is not enough information provided to know which library or h/w is involved.

In terms of support for PCF8574 based backpacks used to drive hd44780 LCDs,
there are several libraries that have a LiquidCrystal_I2C.h header file and provide a LiquidCrystal_I2C class.
Different libraries work differently. They use different constructors and different API calls to initialize the library and LCD.
Some replace the LiquidCrystal library that comes bundled with the IDE.
Some come with examples and some don't.
One LiquidCrystal_I2C library can be installed using the IDE library manager but the others can not and require a manual installation.
Most only work with a specific backpack, some allow the sketch to configure the library as to how the PCF8574 is wired up to the hd44780 LCD so that it can work with any backpack.

If you have a PCF8574 based i2c backpack, I'd recommend that you take a look at my hd44780 library package.
It can be quickly and easily installed using the IDE library manager.
It will automatically locate the backpack i2c address as well as auto detect the pin mappings between the PCF8574 chip and the hd44780 LCD.
It also includes examples including a diagnostic sketch to verify that the i2c bus is working and that the library is working with the LCD and backpack. It will also test the internal memory inside the LCD module.
You can read more about it here: GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library

The i/o class you will want to use for a PCF8574 based i2c backpack is hd44780_I2Cexp.
The first thing you will want to run will be the diagnostic sketch I2CexpDiag.

--- bill

Thanks a lot for your answers! Communication has now been established!