Terminal Widget on Physical LCD display

Hi everybody.

I’m using the terminal widget to send some text on a LCD display (20 x 4) according this code:

    BLYNK_WRITE(V7) // terminal widget on VP7
{
   String text = param.asStr();
   lcd.print(text);
   terminal.flush();
}

But on the LCD side I can see the text on row 1, then row 3, then row 2 and then row 4.
Is possible to fill the text sequentially on row 1,2,3,4?
Thank you

And how is it working (the LCD) without Blynk? It looks it might be some LCD library issue?
…OR the used LCD module has different row addressing…

Hi Marvin, without Blynk it works well also because for every row I specify where text have to start with “setCursor” command:

i.e.
lcd.setCursor(1,0);
lcd.print(“Hello word”);

If so, then I can’t see the string splitting in your posted fragment. Have you tried sending long string (ie 80 chars long) to LCD without Blynk libraries? I’ve seen this behaviour in 4x40 LCD module, but never in 4x20, which is supposed to be single controller only.

Yes, on those physical LCDs, streaming text is normally split between alternating lines… something to do with the design of the memory or controller chip. The only solution is to specifically specify character/string placement… lots of logic code to take a string, split it up to the required line length and specifically place it on incrementing lines, rinse, loop, repeat :wink:

1 Like

That is true @Gunner, but it’s the library’s job to do it, and those I’ve been working with did it correctly on 4x20 (even text scrolling was working), but it all failed on 4x40, even though it was supposed to work. Just a note :slight_smile:

Makes sense… basically what I said, but already packaged up. Go figure :laughing:

Apparently I have never bothered (or apparently thought about :stuck_out_tongue_winking_eye: ) trying that that method with the library… I always pick and placed my text.

I don’t think I have ever seen a 4x40… largest I have is the 4x20 (and I still want a Blynk equivalent :stuck_out_tongue: )

The 4x40 is just a 2x40 stacked. So a two controllers are onboard.

Usually it’s the best way when building UI. Or terminal-like display (full control over text lines). But it works, when supported :stuck_out_tongue:

@Gunner @marvin7 …ok guys after a long night… i got it!!
This is the code to visualize all the 80 characters in right position. I used “text.substring” to extract the text inside a string sent via Terminal, put it in an array row by row and then write them on LCD according to right position.
What do you think? Have I waste my night or is a good solution? :stuck_out_tongue_winking_eye:

  BLYNK_WRITE(V7) //invio tramite terminal
{
  lcd.backlight();
  lcd.clear();
  String text = param.asStr();
  char val_1[21];
  char val_2[21];
  char val_3[21];
  char val_4[21];
  String row1 = text.substring(0,20);
  String row2 = text.substring(20,40);
  String row3 = text.substring(40,60);
  String row4 = text.substring(60,80);
  row1.toCharArray(val_1,21);
  row2.toCharArray(val_2,21);
  row3.toCharArray(val_3,21);
  row4.toCharArray(val_4,21);
  lcd.setCursor(0,0);
  lcd.print(val_1);
  lcd.setCursor(0,1);
  lcd.print(val_2);
  lcd.setCursor(0,2);
  lcd.print(val_3);
  lcd.setCursor(0,3);
  lcd.print(val_4);
}
2 Likes

You did it “manually” (could use “for” loop or similar), but there is nothing wrong about it. :smiley:

1 Like