I am trying to use the liquidCrystal i2c and also the standard one in a project.I use Eclipse to write for arduino.
The library works fine at arduino IDE, but when i try to call the constructor on the Eclipse project by writing:
LiquidCrystal_I2C lcd(0x27);
i get an error that the lcd object has to implement the pure virtual method Print::write.
LiquidCrystal class is a subclass of LCD class and LCD class is a sub of Print.LCD has a write method that does not overide the pure virtual method of Print class and also iboth of them LCD and Print are abstract class cause of write function in Print class and send function in LCD class.
What should i do in order to make this work.I tried to make a function in LiquidCrystal library like this:
size_t write(uint8_t value);
but this declaration was overiding the function LCD:write and basically was shadowing.This also brings problems to other function inside liquidCrystal lib that call the LCD::write function.
Of course the LCD::write has inside the private pure virtual method send that can not be called outside lcd class.SO i can not implement the liquidCrystal::write as the LCD::write cause i can not call send funtion.
My guess would be that there are multiple libraries colliding with each other.
i.e. the sketch code may be trying to use code from one library but it or
the library itself is getting headers from another library that happens to have the same name.
Also, the two i2c lcd libraries you are referencing are very different.
They do not work the same and when given a sing address parameter
to the constructor will require very differnt wiring between the LCD and the PCF8574.
I'm not sure how you specify the include paths when using eclipse or
whether it locates them on its own.
Is there anyway you could post the compile command strings?
Does the eclipse plugin show the full command lines?
I'd like to take a look at the include paths being used.
If you are wanting/need to use both i2c and 4bit modes to talk to the LCD,
then I highly recommend using fm's library as that is the only library
capable of doing that.
To avoid any potential header file issues, I'd recommend that you move/rename the existing
original LiquidCrystal library that came with the IDE and replace it with fm's library.
It was designed to be a drop in replacement for the LiquidCrystal library.
Also be sure to remove any other previous/old installations of LiquidCrystal libraries
like LiquidCrystal_I2C.
The key to getting fms' i2c lcd interface working correctly is that you must
tell it how the PCF8574 is wired up to the LCD module.
This is because that library makes no assumptions as to the wiring
but rather instead requires the user to specify it in the constuctor.
Do not use a constructor with just an i2c address as that uses a wiring
for fm's (electroFun) LCD extra I/O board which more than likely
you do not have.
Well i used fm library with arduino ide and it worked as i have said at the begining.I had to correct the arguments at the constructor.So my problem in Eclipse is located somewhere else.
First my eclipse project where set from the guide of the playground about arduino core library(which is not what you asked) and in every project i copy the extra libraries i want to use that are not included in the arduino core library.These type of libs are Ethernets's ,LiquidCrystal's header and cpps and every lib that i write.So my project in eclipse read what ever i give.
The problem in the fm's library is that it needs lcd.h and i2cio.h.And this is a problem because lcd class is a subclass of Print class(that exist in arduino core lib).So tho lcd is a sub class it does not implement a the pure virtual function write that Print has(tho it has it's own write function).And my problem is that eclipse understands that LiquidCrystal_I2c lib is a subclass of lcd which is a subclass of Print and it asks me for an implementation of write.Well when i try to implement it and i try to write a function named write the Eclipse says that this overrides the function write that exist in lcd class.But the write function inside lcd does not overrides the pure virtual function of Print.
So the problems are 2:
First: why a function that has the same name the same arguments and the same return type could not me recognised as an implementation of the pure virtual function write that exist in Print(i am talking about the lcd class)
Second: how can i make a function named write to liquidcrystal_I2c lib and make it not to overide the write function that exist in lcd but the write function that exists in Print
well i have a bigger project that have maid in eclipse which is a more complete ide in general.I need to add things to it so i make smaller projects to test new items and then i add them to tha main program.So i want to add an lcd.
well i you have any experience with eclipse forum you wouldn't do that question.Well anyway i managed to solve my problem and i am sure that this is not an eclipse problem it was a programming in general problem that had to do with libraries that lcd use in general.
kyrpav:
Well anyway i managed to solve my problem and i am sure that this is not an eclipse problem it was a programming in general problem that had to do with libraries that lcd use in general.
I'm interested in what the problem and how you solved it.
From what you wrote in resonse #5,
I thought it was sounding like it wasn't an issue with fm's library but either a case
of the eclipse plugin not handling a more complex class structure or that not
all the needed files were being copied over or an issue with include paths.
If there is a silent issue in fm's library I'd liked to understand it so we can get
the library properly updated.
Can you elloborate on what the actual problem was and how you solved it?
It was an eclipse problem not a library problem.The only thing that was not correct in the library was the pins that are defined for rw ,enable , etc which for these another post in the forum has it correct so i just changed them and it worked before i had to do my last choice which was to open the datasheets of the I2C driver to check the pinout of it and the board's pinout path