The leJOS Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail

Trail: Essential leJOS classes
Lesson: Controlling the Hardware

Controlling the Hardware: The LCD


The display on the the upper side of the RCX is more or less the only possibility to show messages directly to the user (a fact which makes debugging with leJOS rather challenging); it is able to display up to five numbers or letters.

LCD

The static LCD class offers various methods to access each of these segments or the complete display area: for clearing and refreshing and for displaying.
The segment codes are constants defined in the Segment interface, e.g. Segment.BATTERY,Segment.WALKING, Segment.STANDING and so on.
Note that you have to call refresh() after setting the segment!

There is a memory saving alternative to the LCD class: the MinLCD class contains only the public static void setNumber(int aCode,int aValue,int aPoint) and the refresh() method.

TextLCD

Another class for sending output to the display is the TextLCD class. It offers methods to write chars or even Strings up to five characters:

A complete example which uses the LCD class

is PerformanceTest.java which may be found in the examples/performance_test section of the leJOS tree.

The API

may be found here for LCD and for TextLCD.
The leJOS Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail