#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

const char msg0[] = "                "; // 16 spaces
const char msg1[] = "Hello, this is a long message that will scroll on the screen 1234 abcdefg !@#$%^&*()                ";
int msgSize = sizeof(msg1);
const int screenWidth = 16; // chagracters in array
char page[screenWidth]; // rows of characters for the LCD

void setup() {
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
}

void loop() {

  for (int i = 0; i < msgSize - screenWidth; i++) { // stop one "row" before end of message
    for (int j = 0; j < screenWidth; j++) { // 16 characters
      page[j] = msg1[i + j]; // create a new page (LCD line) to print
    }
    lcd.setCursor(0, 0); // cursor home
    lcd.print(page); // print new page
    delay(100);
  }
}