I hope this is an easy answer but when I import the library for LiquidCrystal_I2C in order to get my SunFounder 16x2 LCD to work via serial comm, it appears the library is not loading as I get the following errors:
This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: “Arduino Uno”
LCD_Display_Serial_SunFounder:18: error: ‘LiquidCrystal_I2C’ does not name a type
LCD_Display_Serial_SunFounder.ino: In function ‘void setup()’:
LCD_Display_Serial_SunFounder:22: error: ‘lcd’ was not declared in this scope
LCD_Display_Serial_SunFounder.ino: In function ‘void loop()’:
LCD_Display_Serial_SunFounder:28: error: ‘lcd’ was not declared in this scope
I know the library has the required files but I’m wondering if I need to perform any additional tasks in order for the library to be associated with the program file.
Yes I have restarted the IDE after importing the library of interest.
Yes, I have included the .h files
Here is the line that generates the errors…
What am I doing wrong?
Thank you in advance.
More than likely, you have either not installed the library or installed it improperly or did not exit and restart the IDE after installing it.
There are many libraries all called LiquidCrstal_I2C, so it isn't clear which one you are trying to use.
Also, the library you are trying to use is for an LCD that is using a PCF8574 backpack which is not a serial comm.
If you have a serial based LCD, this is not the correct library.
If you do have a PCF8574 based backpack that library may or may not work with your backpack.
This is because not all manufacturers wire up the PCF8574 to the LCD the same way.
That library hard codes the wiring so if the wiring on your backpack does not match the way the library assumes it to be wired, it will not work.
A few other libraries (some of which are also named LiquidCrystal_I2C) solve this by allowing the sketch to configure the pin mappings.
IDE 1.0.6 is quite old.
The newer IDEs have a library manager that makes installing libraries so much easier as you can install them directly from the Arduino IDE GUI vs having to install them manually.
I'd recommend that update your IDE to a newer IDE to pick up some of the newer & better capabilities like the library manager.
If you have a PCF8574 based backpack, I'd recommend that you consider using my hd44780 library.
It can automatically locate the i2c address and auto detect the pin mappings so it should work with your backpack without having to set the address or configure the pin mappings.
The library also comes with a diagnostic sketch which will test your i2c signals and attempt to verify the RAM on the LCD module to makes sure the library is properly working with the LCD module.
You can read more about it here: GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library
The github page has information about it as well as installation instructions.
If you have IDE 1.6.9 or newer (I'd recommend jumping up to the latest IDE which is currently 1.8.2) then you can use the IDE library manager to install it quickly and easily.
Older IDEs require a more complicated manual installation.
The i/o class for a PCF8574 based backpack is hd44780_I2Cexp.
The diagnostic sketch is called I2CexpDiag.