LCD Keypad Shield

LCD Keypad Shield: Scrolling Text

More than 16 characters? Scroll the display left and right.

Scrolling the whole display

lcd.scrollDisplayLeft() and lcd.scrollDisplayRight() shift everything on the screen by one column each time they are called. Put them in a for loop with a short delay and the text glides.

The arithmetic in the sketch: with a 13-character message on a 16-column display, scrolling 13 steps left takes it fully off the left edge, 13 + 16 = 29 steps right takes it fully off the right edge, and 16 steps left brings it back to where it started. Change the message and update those three numbers to its length, its length plus 16, and 16.

You do not have to do the full out-and-back; a few steps left then right gives a gentle wobble, which is a nice idle animation for a menu.

Scroll left, right, and back