how does F Malpartida's LCD prog do this

This is a small part of the full program, it works but

I would have thought the following program would move "the answer" five places to the right and then start again from the left.

void keywords()
{
lcd.setCursor(0,0);
lcd.print("the answer");
  for (int l=0; l<5; l++)
  {
  lcd.scrollDisplayRight();
  delay(500);
  }
}

It starts from the left and continues off the screen to the right then comes round again after a few seconds. Can anyone tell me why and how I can get it to just move a few spaces to the right?
Thanks.

When you scroll right, I suspect that the library is not keeping track of the new positions.
After several loops the 5 rights will wrap back to the beginning again.

Likewise, setCursor() will be referring to the memory address and not how many shifts you have done.

If you call CLRHOME, or HOME, it should reset everything back to normal.

In other words, if you choose to scroll right by N steps, you need to remember it. Or make N scrolls left.

Pure speculation. I have not even looked at the code.

David.

Hi David,
I would have thought setting the cursor to 0,0 would set it back but no, if I put lcd.home before lcd.setCursor it almost works correct. If I comment out setCursor with home in it still goes back.
I say almost because it starts at symbol 1 instead of 0.
If I comment the scroll line out it starts at 0?
I can't get it to start at 0 and scroll right?
So you were partially right in that it needs home to get it back to the start of the line but the scroll instruction moves it right one symbol before it prints it?