4

I have an I2C LCD screen provided with a Sunfounder kit and certainly built by DFRobot or such a constructor (there is nothing written on the LCD), and an Arduino Uno R3 copy.

My issue is when I use lcd.print() to write a string on the LCD, only the first character of the string is printed. I can only print on other positions by using setCursor but only one character at a time.

I tried to change libraries (https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library, the one supplied with the LCD...), It always behaves the same!

For example, here's a very simplistic program which exhibits this behavior:

#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();
  lcd.backlight();
}

void loop() {
  lcd.print("write");
  delay(1000);
  lcd.setCursor(10, 0);
  lcd.print("p10");
  lcd.setCursor(0, 1);
  lcd.print("0, 1 write");
  if((millis() / 1000) % 5 == 0) {
    lcd.clear();
    delay(1000);
  }
}

I end up with something like:

w      p   
0w         

On the screen (before the clear() occurs of course).

Instead of something like:

write  p10      
0, 1 writewrite

The lcd itself was ok some time ago. The only thing I could think is I recently updated to Arduino 1.6.6. Can it be a bug in the compiler?

The hello world from DFRobot also doesn't work properly (first char only, again) (please note to make it display something with my LCD I have to change the address from 0x20 to 27).

3

That's definitely a bug appeared in 1.6.6. For reference, see https://blog.arduino.cc/2015/11/03/arduino-ide-1-6-6-released-and-available-for-download/#comment-278766 https://forum.arduino.cc/index.php?topic=359652.0 http://forum.arduino.cc/index.php?topic=357312.msg2476987#msg2476987

Last link seems to provide a solution, by a updated version of LCD I2C lib : https://github.com/marcoschwartz/LiquidCrystal_I2C (not yet tried).

The 1.6.6 is a bit messy according some people, but the I2C lib too ;). So the question is : where should it be fixed ?

2

Your code contains, in part,

#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();
  lcd.backlight();
}

For all of the constructors in LiquidCrystal_I2C.h on my system, the second and third parameters are EN and RW, ie, the enable and read/write backpack-pin numbers. They don't specify the size of the display.

I suggest trying constructor usage like

LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7); // 0x27 is the I2C bus address for an unmodified backpack

and in place of lcd.init(); say

lcd.begin (16,2); // for 16 x 2 LCD module

Note, lcd.begin() will call init().

  • Hello and thanks for your answer. The code I supplied was previously working, your LiquidCrystal_I2C lib should be different if you don't have at all the same ctor than mine. But I'll do a try with yours to see if if fixes my problem. – AFract Nov 23 '15 at 8:18
1

I'm incredibly new to Arduino (I literally got one a few hours ago and I'm still finding my feet with it!) so take that into account when considering anything I say however I'd be inclined to agree that this may be an issue with the 1.6.6 IDE.

I was getting pretty much the same symptoms on a Freematics MEGA2560/3.2" SSD1289 LCD using the MultiLCD library using 1.6.6. Based on your comment above I uninstalled and installed 1.6.5 instead, recompiled and uploaded and it's now displaying properly...

  • Hello, thank you very much to confirm the behaviour I've seen. I had not time yet to look for other solutions like the suggestion of jwpat7. – AFract Nov 27 '15 at 18:49
1

I tried the solution described by AFract and it solved the problem. (sorry, I couldn't reply to his comment because I don't have enough reputation.)

I got the new LiquidCrystal_I2C library here: https://github.com/marcoschwartz/LiquidCrystal_I2C

Info on the code commit is here: https://github.com/marcoschwartz/LiquidCrystal_I2C/pull/5

1

I have had same problem, issued on v1.6.7 and v1.6.8. I solved it with the new 'marcoschwartz' library specified in other answers.

Previously, I had used the same DFRobot library, which worked fine on IDE 1.6.0, until I upgraded on v1.6.7.

  • 1
    Welcome on Arduino Stack Exchange. "Thanks" and "Me too" answers aren't really considered usefull (meta.stackexchange.com/questions/256378/…). In your case, you do give some interesting information, but keep it in mind. You should only add an answer if it is different from another answer given and will actually answer the question. – Paul Mar 17 '16 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.