Hardware Reference
In-Depth Information
So how can you print all that? The answer lies with scrolling, pushing existing
characters out of the way for new text.
Text can be scrolled in two directions: left and right. The following functions
shift both the text and the cursor by one space, either left or right:
lcd.scrollDisplayLeft();
lcd.scrollDisplayRight();
Automatic scrolling enables a simpler approach; text is automatically shifted
when a character is printed to the screen. Automatic shifting can be done in both
left-to-right or right-to-left coni gurations and depends on the current position.
To enable autoscroll, call autoscroll() :
lcd.autoscroll();
From here on, subsequent writes to the screen will result in previous char-
acters to be automatically shifted. To disable autoscroll, use noAutoscroll() :
lcd.noAutoscroll();
Note that the cursor is also autoscrolled; this has the effect of always writing
new characters to the same position.
Custom Text
Alphanumeric LCD screens are widely used, and it is not possible to imagine
every use case before production. Although most simply display the time or
short text, some require more advanced use. Imagine a home wireless telephone;
the LCD screen is designed to print simple text, phone numbers, and why not
a menu system to coni gure the telephone, but the constructor also wanted to
add some information: the current battery level. It would be possible to display
the battery level as a percentage or simply to ignore the battery if it is more than
25 percent charged, but maybe you would like to create your own character,
something that resembles a battery. Maybe an elevator in a high rise building
has an intelligent system. If you want to go to l oor 42, the elevator will tell you
to use a particular elevator. For example: Floor 42,
. The arrow will indicate
that you should use the elevator on the right. It is more visual than writing text
and might even be more economical to use such a solution because a smaller
screen can be used. LCD screens already have a large amount of characters
prerecorded, but there is still room for eight custom characters.
To create custom characters, an array of binary data must be created. This
data is arranged in eight lines of 5-bit binary data, like so:
byte smiley[8] = {
B00000,
B10001,
 
Search WWH ::




Custom Search