LCD Is only printing one character instead of full string? (Same in Serial too)

Hey all,

I am currently using this code

/*
 * Displays text sent over the serial port (e.g. from the Serial Monitor) on
 * an attached LCD.
 * YWROBOT
 *Compatible with the Arduino IDE 1.0
 *Library version:1.1
 */
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  lcd.print("hello, world!");
}

void loop()
{
}

But the LCD only displays “h”?

Has anyone else encountered this problem?

Thanks,
Harry.

Hello and welcome,

There is something wrong on this line:

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

The comment does not match the actual code.

Also change lcd.print to lcd.printstr sorry I was wrong

Isn't this the print change in 1.6.6? I think a change is needed to the library? I'm on phone now, can't easily grab the info, but it aims really familiar

Should I be using a different version of Arduino IDE?

EDIT:

Just downgraded to 1.0.5 and it works. Should I stick with this version or find a way to get it working on the latest IDE?

There is a bug in the latest version with Wire where it returns an error even when the transmission was successful. Here is a thread from the displays forum with the answer you need:

As I understand it, the issue is with the i2c lcd library being used not the underlying Wire.h.

It is library specific. The F. Malpartida i2c lcd library returns 1 with a write and does not have the problem.

There is a commonly used library by Mario H. which does show the problem because it returns a 0 upon a successful write.

There are many versions of i2c lcd libraries floating around on the internet, and who knows what lurks where?

You’re right. I read that link again and it is the I2C LCD library and not Wire that has the problem. Either way, the fix is in that link I just gave.