Go Down

Topic: How to scroll 1 line in 20x4 LCD display? (Read 1 time) previous topic - next topic

cliqck

Hy,

does anyone know how to scroll text (only 1 line) on 20x4 LCD?

Here is the sample video link:
http://www.youtube.com/watch?v=4OT4hsLImmw

I've tried using lcd.rightToLeft(), but it always scroll the text between 2 lines.

Pls help.

liudr

Does the video have a link to the code used in the scroll?

You need a buffer of the string and keep writing to the LCD with "____H", the "___HE", then "__HEL", then "_HELL", finally "HELLO", so it scrolls. The underscore signifies space.

bperrybap

#2
Nov 17, 2012, 09:41 am Last Edit: Nov 17, 2012, 09:43 am by bperrybap Reason: 1
I'd create a buffer that is as large as the scrolling message but
at least as large as a line even if the message is shorter than a line,
(unused positions are <SPACE> )
That way you won't have to worry about having to insert spaces at the front
or the back of the message when scrolling short messages.

Position the cursor to the left most position on the line.
Then index into the buffer and display as many characters as will fit on the display.
You can vary the starting index to control which character is on the left side of the display.
As you pull characters from the buffer if you reach the end of the buffer you roll around
back to the start of the buffer.
To make the message appear to scroll you increase/decrease the starting index
and re-draw the line.
If the starting index increases, the message scrolls to the left if the starting index
decreases the message scrolls to the right.

-- bill

Go Up