Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

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 > 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.

share|improve this question

1 Answer 1

I would do the following (beware - not tested):

lcd.clear();
lcd.setCursor(15, 0);
lcd.print("x");
for (int i = 0; i < 15; i++) {
    lcd.setCursor(0, digitalRead(switchPin) == LOW);
    lcd.print("5");
    delay(500);
    lcd.scrollDisplayLeft();
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.