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.
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 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.
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 any suggestions?