In an older post, I reviewed the VEX LCD and provided some uses for it. Now I will explain some of the commands to program the VEX LCD with ROBOTC.
To tell ROBOTC which port the LCD is plugged into, go to Robot > Motor and Sensors Setup…
ROBOTC provides many functions for displaying text. I find the most useful to be displayLCDString(nLine, nPos, sString) and displayLCDCenteredString(nLine, sString). Where nLine is the line (values 0 or 1), nPos is the starting point of the string (values 0-15), and sString is the string to display (max 16 characters). These are pretty self explanatory–the “plain” version allows you to set a starting position for the string, while the “centered” version automatically centers your string.
Clearing the Display
Eventually, you’ll want to clear the text you’ve displayed. Use the clearLCDLine(nLine) function to clear a specified line (where, again, nLine is a 0 or a 1).
Using the Buttons
The currently pressed button is accessed using the variable nLCDButtons. This variable has 4 possible values:
0: No button
1: Left button
2: Middle button
4: Right button
I don’t know why it’s numbered 0, 1, 2, 4–but it is, and we have to work with it.
To turn on the LCD backlight, set the Boolean variable bLCDBacklight to true. A value of false (the default) will turn off the backlight.