In this, I have changed the position of the cursor using a loop. The loop run from the last index of the LCD till the last index of the entered text including space at the end of the text. Space is added at the end so that the display looks blank before the next text appear.
The cursor will move according to the loop.
If any problem feels free to ask.
#include <LiquidCrystal.h>
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
void setup() {
lcd.begin(16,2);
lcd.setCursor(1,0); // Cursor position is fixed for static words.
lcd.print("First Line");
}
void loop() {
for(int i=15;i>=-13;i--) // loop to move the word in the second line which will start from the last index of the LCD till the space at the end of the word which will be in negative,so that
// the whole word get disappear from the screen (16 positions on the display i.e. 0 to 15 and number of letters of the text entered + space at the end of the text)
{
lcd.setCursor(i,1); // cursor position will be according to 'i'
lcd.print("Second Line1 ");
delay(100);
}
for(int j=15;j>=-13;j--) // Same for this loop
{
lcd.setCursor(j,1); // same for this cursor's position
lcd.print("Second Line2 ");
delay(100);
}
}