Right, very final code, with some comments:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 13, 8, 9, 5, 11);
int x;
int y;
char myMsg[128];
void setup() {
Serial.begin(9600);
delay(500);
lcd.begin(16, 2);
lcd.print("Bienvenue");
delay(2000);
strcpy(myMsg, "GO-scrolling message scrolling message scrolling message-STOP_"); // put an extra char at the end of the message, which won't be displayed
lcd.clear();
lcd.setCursor(0,0);
lcd.print("MESSAGE: "); // This message wont move
}
void loop() {
scroll(myMsg,1);
}
void scroll(char msg[], int pos){
x = 0;
y = 0;
for (x = 0; x < strlen(msg) - 1; x++){
if (msg[x + y] == '\0') break; // out of the loop at the end of message
for (y = 0; y < 16; y++){ // for a 2x16 LCD screen
if (msg[x + y] == '\0') break;
lcd.setCursor(y,pos); // pos is the line where the message will appear: 0 is first line, 1 is second line.
lcd.print(msg[x+y]);
}
if (x == 0) delay(1000); // wait 1 second at the beginning of the message
delay(200); // speed of scrolling
}
delay(1000); // wait 1 second when message is at its end
}