But i will also put text at Row two, but whatever i try , this text will scroll either.
That's what the scrollDisplayLeft() and scrollDisplayRight() methods do.
You want to emulate scrolling, by changing the message shown on line 1 each time through loop.
Show like so
Arduino is great
rduino is great A
duino is great Ar
It isn't that difficult to shift the array around. Even better, though, is to simply print two different parts of the one array each time. First, print 0 to n of the array and nothing. Then, print 1 to n and 0. Then 2 to n and 0 to 1. Then, 3 to n and 0 to 2. Keep this up until you are printing n and 0 to n-1. Next time, you start over.
That worked great but then my ATTiny85 ran out space as fast as you can count bits. I want to post my results in case someone needs a little nudge in the future.
I stayed up all night tweaking out this code that works great with the ATTiny85:
byte counter = 1, ceiling = 18, leadingPos = 0;
void animation(byte textChoice){ //method accepting a number for distinct choice of text for message
char * message; //33 characters sized for 20x4 LCD
if(textChoice == 0){
message = "Good Morning "; //33 chars exactly
}
else if(textChoice == 1){
message = "Good Afternoon "; //33 chars exactly
}
else if(textChoice == 2){
message = "Good Evening "; //33 chars exactly
}
else if(textChoice == 3){
message = "Good Night "; //33 chars exactly
}
lcd.setCursor(ceiling,0); //ceiling initialized to 19 outside of method's scope
for(byte n = leadingPos; n <= counter; n++){ //counter initialized to 0 outside of method's scope
lcd.print(message[n]);
}
ceiling -= 1;
counter += 1;
if(counter >= 19){ //after 20th iteration for 20 pixel widths, increase leadingPos to snip leading characters
leadingPos += 1;
}
if (counter == 32){ //number equal to message length or greater outputs artifacts, while less results in incompleteness
counter = 0 ; //reset counter to 0 after one successful scroll
ceiling = 19; //reset ceiling to 19 after one successful scroll
leadingPos = 0; //reset leadingPos to 0 after one successful scroll
}
}
I made a solution for this very same problem about a year ago, its somewhere on the forum though. If I had my laptop I would give you a working sketch but sadly I am on my tablet and won't be back home until tomorrow night. If you want, look up LCD compass and my username, you should be able to find the post.