Pages: [1]   Go Down
Author Topic: How to scroll 1 line in 20x4 LCD display?  (Read 1665 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Here is the sample video link:

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

Pls help.

Central MN, USA
Online Online
Tesla Member
Karma: 75
Posts: 7265
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Dallas, TX USA
Offline Offline
Faraday Member
Karma: 70
Posts: 2740
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: November 17, 2012, 03:43:10 am by bperrybap » Logged

Pages: [1]   Go Up
Jump to: