NXT LCD Display

The NXT is equipped with a 100 wide by 64 pixels high display. The bottom left corner is point (0, 0) and the top right corner of the display is point (99, 63). RobotC has a rich set of functionality for drawing text and shapes on the LCD screen.

 

nViewStateNXT           

Controls which of the four different predefined LCD screens should be displayed. The different screens can alternatively be activated via the left and right buttons. The displays include the “standard” NXT display, a sensor display, a motor display, a graphical display of the last points added to the datalog and a user draw display.

 

The user draw display is also activated whenever one of the following functions is called.

 

eraseDisplay()

Completely erases the NXT LCD display

 

nxtDisplayString(nLineNumber, sFormatString, parm1, parm2)

Formats a character string according the the format specified in sFormatString using parameters parm1 and parm2. Display the result on text line nLineNumber. The remainder of the line is not altered; so that if the result string is 8 characters only the first eight characters of the text line are updated. The contents of the remaining characters on the line are not changed. Note that parm1 and parm2 are optional parameters; the value zero will be substituted if they are not present.

 

There are eight text lines numbers 0 to 7. 0 is the top line and 7 is the bottom line of the display.

 

nxtDisplayClearTextLine(nLineNumber)

Clears (erases, fills with blanks) text line nLineNumber

 

nxtDisplayTextLine(nLineNumber, sFormatString, parm1, parm2)

Same as nxtDisplayString except the complete text line is replaced. The line is padded with blank characters at the end. For example:

nxtDisplayTextLine (3, “Sensor is %03d”, SensorValue[S1);

would result in a display of “Sensor is 038” on text line 3. The format specification “%03d” says to take the integer parameter and format it as a 3-character decimal value.

 

nxtDisplayCenteredTextLine(nLineNumber, sFormatString, parm1, parm2)

Same as nxtDisplayTextLine except the text is centered on the line instead of left-justified.

 

nxtDisplayStringAt(xPos, yPos, sFormatString, parm1, parm2)

Formats a character string and displays it starting at point (xPos, yPos) on the screen.

 

nxtDisplayBigStringAt (xPos, yPos, sFormatString, parm1, parm2)

Similar function to nxtDisplayStringAt but draws using a large 16-pixel high font.

 

nxtScrollText(sFormatString, parm1, parm2)

Shift the LCD image up one line. Then formats a text string and displays it on the bottom line of the LCD text screen.

 

nxtClearPixel(xPos, yPos)

nxtSetPixel(xPos, yPos)

Clears or sets the pixel located at point (xPos, yPos)

 

nxtDrawCircle(Left, Top, Diameter)

Draws a circle at the point (Left, Top) with specified Diameter.

 

nxtDrawLine(xPos, yPos, xPosTo, yPosTo)

Draws a line between points (xPos, yPos) and (xPosTp, yPosTo).

 

nxtDrawRect(Left, Top, Right, Bottom)

nxtEraseRect(Left, Top, Right, Bottom)

nxtFillRect(Left, Top, Right, Bottom)

Operates on a rectangle defined by the position (Left, Top, Right, Bottom). Either draws (i.e. draw outline), fills or erases depending on the function called.

 

nxtDrawEllipse(Left, Top, Right, Bottom)

nxtEraseEllipse (Left, Top, Right, Bottom)

nxtFillEllipse(Left, Top, Right, Bottom)

Operates on a ellipse bounded by the rectangle (Left, Top, Right, Bottom). Either draws (i.e. outlines), fills or erases depending on the function called.

 

nxtDisplayIconFile(xPos, yPos, sFileName)

Displays a ICON file at the selected point (xPos, yPos) Note: this command is not presently implemented. It will be available in a future RobotC release.