#define LCD_COL_SIZE 20
#define LCD_ROW_SIZE 4
#define SCROLL_SPEED 300

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, LCD_COL_SIZE, LCD_ROW_SIZE); // Set the LCD address to 0x27 for a 16 chars and 2 line display
String newPlace = "URBAN ESTATE, PHASE - 2, PATIALA";
const int placeLen = newPlace.length();
int mIndex, nIndex;

void setup() {
  lcd.init(); // Initialize the LCD
  lcd.backlight(); // Turn on the backlight (if available)
}
void loop() {
  mIndex = 0;
  nIndex = LCD_COL_SIZE;
  if(placeLen > LCD_COL_SIZE) {
      for(int jIndex = 0; jIndex <= placeLen - LCD_COL_SIZE; jIndex++) { // Sliding window scroll left
        lcd.setCursor(0, 3);
        for(int kIndex = mIndex; kIndex < nIndex; kIndex++) {
          lcd.print(newPlace.charAt(kIndex));
        }
        delay(SCROLL_SPEED);
        mIndex++;
        nIndex++;
    }
    delay(1000);
    lcd.setCursor(0, 3);
    for(int kIndex = 0; kIndex < LCD_COL_SIZE; kIndex++) {
      lcd.print(newPlace.charAt(kIndex));
    }
    delay(1000);
  }
  else {
    lcd.setCursor(0, 3);
    lcd.print(newPlace);
  }
}