Good morning everyone.
I recently purchased a 20×4 LCD display with I²C interface with the following code (the LiquidCrystal_PCF8574.h library was suggested to me by the person who sold me the display and I installed it)
#include <LiquidCrystal_PCF8574.h>
#include <Wire.h>
LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display
int show = -1;
void setup()
{
int error;
Serial.begin(115200);
Serial.println("LCD...");
// wait on Serial to be available on Leonardo
while (!Serial)
;
Serial.println("Dose: check for LCD");
// See http://playground.arduino.cc/Main/I2cScanner how to test for a I2C device.
Wire.begin();
Wire.beginTransmission(0x27);
error = Wire.endTransmission();
Serial.print("Error: ");
Serial.print(error);
if (error == 0) {
Serial.println(": LCD found.");
show = 0;
lcd.begin(20, 4); // initialize the lcd
} else {
Serial.println(": LCD not found.");
} // if
} // setup()
void loop()
{
lcd.setBacklight(255);
lcd.home();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Hello LCD");
delay(1000);
lcd.setBacklight(0);
delay(2000);
lcd.setBacklight(255);
}
The setup works because it prints "LCD found".
In the loop also works "lcd.setBacklight()" because the backlight turns on and off according to the delay() but it does not print anything, everything remains blue, I also already used the code to check the link position and it finds the device at 0x27.
I add that the controller was soldered to the LCD by factory, do you know what I could have done wrong?
Thanks to all