#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
String Word = "mohamed hamdy ";
bool flag = true;
void setup ()

{
  lcd.begin(16, 2);
  lcd.print(Word);

}
void loop ()
{


  for (int i = 0; i < 15; i++) {
    one();
  }
  lcd.clear();

  for (int i = 0; i < 15 + Word.length(); i++) {
    tow();
  }

  lcd.clear();


  // delay at the end of the full loop:
}
void one() {

  lcd.setCursor(0, 0); // Set cursor to the first line
  lcd.print(Word);
  lcd.scrollDisplayRight();
  // wait a bit:
  delay(100);
}
void tow() {
  lcd.setCursor(15, 1); // Set cursor to the first line
  lcd.print(Word);
  lcd.scrollDisplayLeft();
  // wait a bit:
  delay(100);
}