//Compatible with the Arduino IDE 1.0 and above
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
// set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
}
ERROR:
Arduino: 1.8.8 (Windows 7), TD: 1.45, Board: "Arduino Nano, ATmega328"
sketch_may09b:6:32: error: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]
LiquidCrystal_I2C lcd(0x27,16,2);
^
In file included from C:\Users\HUA.DELLV-PC\Documents\Arduino\sketch_may09b\sketch_may09b.ino:4:0:
C:\Program Files (x86)\Arduino\libraries\LCD/LiquidCrystal_I2C.h:53:4: error: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)' [-fpermissive]
LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);
^
C:\Program Files (x86)\Arduino\libraries\LCD/LiquidCrystal_I2C.h: In function 'void setup()':
C:\Program Files (x86)\Arduino\libraries\LCD/LiquidCrystal_I2C.h:154:9: error: 'int LiquidCrystal_I2C::init()' is private
int init();
^
sketch_may09b:11:12: error: within this context
lcd.init(); // initialize the lcd
^
Multiple libraries were found for "Wire.h"
Used: C:\Users\HUA.DELLV-PC\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.11\libraries\Wire
Not used: C:\Program Files (x86)\Arduino\libraries\Wire-master
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Program Files (x86)\Arduino\libraries\LCD
Not used: C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C
Not used: C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C
Not used: C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C
Not used: C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C
exit status 1
invalid conversion from 'int' to 't_backlighPol' [-fpermissive]
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Program Files (x86)\Arduino\libraries\LCD
Not used: C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C
Not used: C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C
Not used: C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C
Not used: C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C
There are several libraries with different syntax but the same name "LiquidCrystal_I2C.h".
The one which matches your syntax is listed in the library manager as "LiquidCrystal_I2C by Frank de Brabander
There is a newer and superior library called hd44780 by Bill Perry also available through the library manager. I recommend that you use it.
cattledog:
There are several libraries with different syntax but the same name "LiquidCrystal_I2C.h".
The one which matches your syntax is listed in the library manager as "LiquidCrystal_I2C by Frank de Brabander
There is a newer and superior library called hd44780 by Bill Perry also available through the library manager. I recommend that you use it.
cattledog:
There are several libraries with different syntax but the same name "LiquidCrystal_I2C.h".
BTW, I'm using a NANO.
The one which matches your syntax is listed in the library manager as "LiquidCrystal_I2C by Frank de Brabander
There is a newer and superior library called hd44780 by Bill Perry also available through the library manager. I recommend that you use it.
Thank you.
I changed the libraries, new errors came: "hd44780_I2Cexp.h: No such file or directory". and I found it here, but don't how to download:
in fact during the testing, I changed quite few of the libraries. the errors "hd44780_I2Cexp.h: No such file or directory" and "invalid conversion from 'int' to 't_backlightPol' [-fpermissive]" appear alternately。
Here are instructions for the installation of the hd44780 library using the Library Manager.
Install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.
The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.
In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.
groundFungus:
Here are instructions for the installation of the hd44780 library using the Library Manager.
Install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.
The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.
In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.
Thanks
I used the following code, it is OK to upload now. but nothing shown on LCD, why?
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
Serial.begin(9600);
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.print("CANADA ROBOTIX");
lcd.setCursor(1,1);
lcd.print("Hello, world!");
}
void loop()
{
}
For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.
In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.
Another advantage of the hd44780 library is that the author, Bill Perry or bperrybap is active in this forum and will answer questions.