Difference between revisions of "VEX2 Functions Display"

From ROBOTC API Guide
Jump to: navigation, search
Line 10: Line 10:
 
|-
 
|-
 
|''For information about ROBOTC ''string'', please see the article: [[VEX2:_Functions_-_Strings|Strings]].''
 
|''For information about ROBOTC ''string'', please see the article: [[VEX2:_Functions_-_Strings|Strings]].''
 +
|-
 +
|
 +
'''Some display functions offer a precision parameter, which pads the displayed number with either zeros or spaces, until the number of digits is equal to the precision value:'''
 +
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:center; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000;" cellpadding="5%"
 +
  ! style="border-style: solid; border-width: 0px 1px 1px 0px"|''Precision value''
 +
  ! style="text-align:left; border-style: solid; border-width: 0px 1px 1px 0px"|Description
 +
  ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Example Output
 +
  |-
 +
  | style="border-style: solid; border-width: 0px 1px 1px 0px"|-4
 +
  | style="text-align:left; border-style: solid; border-width: 0px 1px 1px 0px"|Pads the displayed number with zeros until the number of digits equals 4.
 +
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|000# <br />00## <br />0### <br />####
 +
  |-
 +
  | style="border-style: solid; border-width: 0px 1px 1px 0px"|0
 +
  | style="text-align:left; border-style: solid; border-width: 0px 1px 1px 0px"|No padding.
 +
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|##
 +
  |-
 +
  | style="border-style: solid; border-width: 0px 1px 1px 0px"|4
 +
  | style="text-align:left; border-style: solid; border-width: 0px 1px 1px 0px"|Pads the displayed number with spaces until the number of digits equals 4.
 +
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|_ _ _# <br />_ _## <br />_### <br />####
 +
  |-
 +
  |}
 +
''Note: Underscore ( _ ) character denotes a space.''
 +
<br />
 
|-
 
|-
 
|}
 
|}
Line 29: Line 52:
 
|-
 
|-
 
|}
 
|}
 
+
<br />
  
 
== clearLCDLine ==
 
== clearLCDLine ==

Revision as of 16:30, 13 February 2012

Main >> CORTEX >> Functions and Variables >> Display


For information about ROBOTC string, please see the article: Strings.

Some display functions offer a precision parameter, which pads the displayed number with either zeros or spaces, until the number of digits is equal to the precision value:

Precision value Description Example Output
-4 Pads the displayed number with zeros until the number of digits equals 4. 000#
00##
0###
####
0 No padding. ##
4 Pads the displayed number with spaces until the number of digits equals 4. _ _ _#
_ _##
_###
####

Note: Underscore ( _ ) character denotes a space.


Color Key
Function:
Variable:


clearLCDLine

void clearLCDLine(const int nLine)
(void) Clears the indicated line of the VEX LCD to blanks.
Parameter Explanation Data Type
nLine The line to clear. 0 is the top, 1 is the bottom. int
clearLCDLine(1);  //Clears the second line of the LCD Screen (0 would be the first line)


displayLCDCenteredString

void displayLCDCenteredString(const int nLine, string sString)
(void) Clears the indicated line of the VEX LCD to blanks.
Parameter Explanation Data Type
nLine The line to display on. 0 is the top, 1 is the bottom. int
sString The string to display. string
displayLCDCenteredString(0,"ROBOT123");  //Displays the string "ROBOTC123" to the center of line 0


displayLCDChar

void displayLCDChar(const int nLine, const int nPos, const int cChar)
(void) Clears the indicated line of the VEX LCD to blanks.
Parameter Explanation Data Type
nLine The line to display on. 0 is the top, 1 is the bottom. int
nPos The position on 'nLine' to display from. int
cChar The char to display. Can be an int or char. int
displayLCDChar(0,0,'C');  //Displays the character 'C' at the first position on the first line.


displayLCDNumber

void displayLCDNumber(const int nLine, const int nPos, const int nValue, const int nPrecision = -1)
(void) Displays a number nValue on line nLine at position nPos.
Parameter Explanation Data Type
nLine The line to display on. 0 is the top, 1 is the bottom. int
nPos The position on 'nLine' to display from. int
nValue The number to display. int
nPrecision The precision of the number. -1 by default. int
displayLCDNumber(0,0,331);  // displays the number 331 at the first position on the first line


displayLCDPos

void displayLCDPos(const int nLine, const int nPos)
(void) Sets the next display position on the VEX LCD.
Parameter Explanation Data Type
nLine The line to display on. 0 is the top, 1 is the bottom. int
nPos The position on 'nLine' to display from. int
displayLCDPos(0,0);  // sets the next character position to the first character on line 1


displayLCDString

void displayLCDString(const int nLine, const int nPos, string sString)
(void) Displays a string sString on line nLine at position nPos.
Parameter Explanation Data Type
nLine The line to display on. 0 is the top, 1 is the bottom. int
nPos The position on 'nLine' to display from. int
sString The string to display. string
displayLCDString(0,0,"ROBOTC");  // displays the string "ROBOTC" starting from the first position 
                                 // on the first line


displayNextLCDChar

void displayNextLCDChar(const int cChar)
(void) Displays a specific character on the VEX LCD.
Parameter Explanation Data Type
cChar The char to display. Can be an int or char. int
displayLCDPos(1,5);       // sets the current LCD position to line 2, character 6
displayNextLCdChar('A');  // displays the character 'A' on line 2, character 6


displayNextLCDNumber

void displayNextLCDNumber(const int nValue, const int nPrecision = 0x40)
(void) Displays a integer number on the VEX LCD.
Parameter Explanation Data Type
nValue The number to display. int
nPrecision The precision of the number. 64 by default. int
displayNextLCDNumber(2365);  // displays the number '2365' onto the LCD screen