I am learning about LCD menus and adapted some examples from the libraries to work with my LCD 1602.
I have noticed that in order to use the New Liquid Crystal library instead of the LiquidCrystal_I2C-1.1.2 (this was the first one I used), I have to change the way I initialize the LCD:
LiquidCrystal_I2C lcd(0x27, 16, 2);
I have to use:
#define I2C_ADDR 0x27
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin);
and in the setup(), instead of:
I need to use:
I find it odd that a new library makes things more complicated, so I am sure I am missing something...?
If you are using the I2C version of the library, then you would be using that with a backpack connected to the I2C pins A4 and A5. And you would be extremely lucky if that worked at all since there are a number of different I2C backpacks which use different wiring and port addresses. Or did you already realise that?
Your second version specifies all of the important parameters instead of taking a wager that your present backpack actually does match the library default.
You are however advised to forget those older libraries, and use bperrybap, Bill's HD44780 library which can be automatically installed using the library manager in the IDE and has a test program which will figure out all the settings for you.
Thank you Paul and yes I am using an I2C i/o exapander backpack. I have connected it to my arduino uno A4 (SDA) and A5 (SCL) pins. Initially I found it strange that it would work this way but it does, so that puzzled me a bit. i am only trying out staff to learn.
Thanks for your advice about the HD44780 library, I have downloaded and as you said it is very easy to use: the examples work fine without any change. I have just had a quick look at the documentation and it looks like it support most functions of the liquidcrystal library. I hope that this means I can use my liquidmenu library with it. I will try as soon as I can.
It appears that the liquid menu library is not working with the hd44780 library...
when I call
I get an error: no matching function for call to 'LiquidMenu::LiquidMenu(hd44780_I2Cexp&)'
the syntax for this function is :
LiquidMenu::LiquidMenu ( DisplayClass & liquidCrystal, uint8_t startingScreen = 1 )
&liquidCrystal - pointer to the DisplayClass object
startingScreen - the number of the screen that will be shown first
I had previously declared the LCD object
hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip
Since I have not been able to use the liquid menu library with the hd44780 library I wanted to ask if anyone can recommend a menu library that would work with the hd44780.
Unfortunately, that library makes some assumptions about i/o classes and uses a config file rather than auto detect or polymorphism to automate things.
You will need to go in an edit LiquidMenu.h to use the hd44780 header files and object class name.
i.e.: at line 52
#define DisplayClass hd44780_I2Cexp