Scroll LCD display connected to an Arduino Uno I want to make some characters scroll left without affecting the first positions in each row of my LCD 16x2 screen. I have this code inside the loop so far:

lcd .clear();
lcd.setCursor(17, 0);
for (int i = 15; i &gt; 0; i--) {
  lcd.print("x");
  lcd.scrollDisplayLeft();
  if (digitalRead(switchPin) == HIGH) {
    lcd.setCursor(0, 0);
    lcd.write(5);
  } else {
    lcd.setCursor(0, 1);
    lcd.write(5);
  };
  lcd.setCursor(17, 0);
  delay(500);
}
lcd.noAutoscroll();


I think it should work, but the character x just moves left by one position, whereas the character in the first position, either in the first or second row doesn't appear at all.
I would do the following (beware - not tested):

lcd.clear();
lcd.setCursor(15, 0);
lcd.print("x");
for (int i = 0; i &lt; 15; i++) {
    lcd.setCursor(0, digitalRead(switchPin) == LOW);
    lcd.print("5");
    delay(500);
    lcd.scrollDisplayLeft();
}