Cursor Control on I2C LCD

Dear All,
Quite new to Arduino - but I really hate things I don't understand!!

What I want to do is scroll a message across the top line of the display .

The idea is:
Print last char
Scroll display right
reset cursor to 0,0
Print next to last char
Scroll display right
reset cursor to 0,0
etc.

But I cant make it work!!
It seems that the cursor is not being reset.
Here is the code:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

char StartString[] = "Hello World";
int i;


void setup()   
{
 lcd.begin(16,2); 
 lcd.backlight(); 
}


void loop() 
{

 for(i=sizeof(StartString)-1;i>=0;i--)
 {
    lcd.print(StartString[i]);
    delay(500);
    lcd.scrollDisplayRight();
    lcd.setCursor(0,0);
 }
 delay(5000);
}

I'm pulling my hair out!!

What am I doing wrong?

Andy

I'm not sure exactly what you are trying to accomplish but I think it can be done!

Go to this web page www.dinceraydin.com/lcd/commands.htm and scroll down until you see the four animated LCD screens. Verify which one is closest to what you want (I think it is the second one) and we will go from there.

Also - go back and modify your original post. Highlight the part that is code and then press the 'code' button (which looks like a scroll with < and > symbols in front).

Don

Hi Don, Thanks for the reply....
Yes, the second one...
I have done as you asked - sorry, didn't know how to do that - and added a missing command.
(too many versions of the code)
As I said, I assumed that I could scroll the characters right, reset the cursor, and print the next char.

Andy

As I said, I assumed that I could scroll the characters right, reset the cursor, and print the next char.

You don't have to do all that, the LCD controller will do it for you.

The cursor should be positioned outside of the loop and the shifting (scrolling) should be set up there as well. Note that the Arduino people have chosen to rename 'display shifting' to 'scrolling'.

I'm not sure exactly which combination of LiquidCrystal Library commands will get you the effect you want so you will have to try some combinations. I would try autoscroll and rightToLeft first.

It's too bad they don't have any way to just send a hex command if you know what you want.

Don