Printing on a 16x1 LCD.

I have a hd44780 16x1 lcd screen. The problem is that it has to be addressed as (8,2) instead of (16,1), now i want to print an array on it, which is longer then 8 letters, but i don't know how to auto move the cursor to the second segment when the word is > 8 letters.

Example Code:

char * words[] = {"abcdefghig",..............}
void setup() {
 lcd.begin(8, 2);
}
lcd.setCursor(0, 0);
lcd.print(words[1]);

Is there any way the arduino could detect if the word in the array is bigger than 8 and move the cursor to the second segment?

P.S I want to keep the array as i will add more words into it.The arduino will select which word to print using my inputs.

You gave up on Printing long sentences or words on a 16x1 LCD. - #2 by michael_x - Programming Questions - Arduino Forum ?

Do you need more details on the union example there ?

With that, you can fill in the text as 16 continuous characters and send them to the LCD as it is required there ( 2 * 8 bytes )

BTW: you do not need this union construct, if you take care with the output and if your text is always > 8 char, such that the first part is always filled..

char message[17] = "Here's a sample"; // in reality filled dynamically

lcd.setCursor(0, 0);
lcd.write((byte*)message, 8); 
lcd.setCursor(0,1);
lcd.print(message+8);

Note the difference between print ( the 0 terninated string )
and write ( a number of characters )

If your text is shorter, you have to add some logic, based on the number of real characters. And you'll have to clear previous characters anyway.
What about always filling your message array with 16 characters, including spaces ?

Oh thank you for this detailed reply :slight_smile: I understand now, yes i didn't understand that one, but now i do. Well yes it will always be more than 8 letters. I will usually have sentences.

This is a duplicate of this thread:

and this thread.
http://arduino.cc/forum/index.php/topic,110923.0.html
I answered in the thread above.

Creating duplicate threads for the same issue/topic is not a good thing to do.

--- bill

Oh im sorry for that, i was just desperate for an answer, anyway i think i already have this library installed with the stock arduino ide installation but it does not automatically move the cursor :confused: any suggestions?