VEX Natural Language
(→untilPotentiometerGreaterThan) |
(→turnLEDOn) |
||
| (11 intermediate revisions by one user not shown) | |||
| Line 1,051: | Line 1,051: | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilPotentiometerLessThan</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">position | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilPotentiometerLessThan</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">position</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,061: | Line 1,061: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the potentiometer sensor reads a value less than a set position. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the potentiometer sensor reads a value less than a set position. | ||
| − | Range: 0 to | + | Range: 0 to 1023 (However due to mechanical stops, you may be limited to the range of 5 to 1018.) |
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,074: | Line 1,074: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|''position'' | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''position'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The function passes if the rotation<br />is less than this value<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The function passes if the rotation<br />is less than this value<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from 0 to | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from 0 to 1023. |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the potentiometer sensor.<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
|} | |} | ||
| Line 1,174: | Line 1,161: | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilLight</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">threshold | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilLight</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">threshold</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,184: | Line 1,171: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the light sensor reads a value lighter than the threshold. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the light sensor reads a value lighter than the threshold. | ||
| − | Range: (light) 0 to | + | Range: (light) 0 to 1023 (dark) |
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,197: | Line 1,184: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|''threshold'' | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''threshold'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The threshold value that <br />an object must be lighter than to count<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The threshold value that <br />an object must be lighter than to count<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from 0 to | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from 0 to 1023. |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
|- | |- | ||
| | | | ||
| − | + | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%" | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
! style="border-style: solid; border-width: 0px 0px 0px 0px"|Usage and Sample with Parameters | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|Usage and Sample with Parameters | ||
|- | |- | ||
| Line 1,238: | Line 1,212: | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilDark</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">threshold | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilDark</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">threshold</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,248: | Line 1,222: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the light sensor reads a value darker than the threshold. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the light sensor reads a value darker than the threshold. | ||
| − | Range: (light) 0 to | + | Range: (light) 0 to 1023 (dark) |
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,261: | Line 1,235: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|''threshold'' | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''threshold'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The threshold value that <br />an object must be darker than to count<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The threshold value that <br />an object must be darker than to count<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from 0 to | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from 0 to 1023. |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
|} | |} | ||
| Line 1,302: | Line 1,263: | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilRotations</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">float </span><span class="bigCodeBasic">rotations | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilRotations</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">float </span><span class="bigCodeBasic">rotations</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,309: | Line 1,270: | ||
! style="border-style: solid; border-width: 0px 0px 0px 0px"| | ! style="border-style: solid; border-width: 0px 0px 0px 0px"| | ||
|- | |- | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File: | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:rotations_vex_pic.png]] |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the quadrature encoder rotations match the desired value. Whole number values only! |
| − | Range: - | + | Range: -32,768 to +32,767 |
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 + interrupt (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,325: | Line 1,286: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|''rotations'' | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''rotations'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of axle rotations to reach.<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of axle rotations to reach.<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from -32,768 to +32,767. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The quadrature encoder to use.<br />(default: | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The quadrature encoder to use.<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
|} | |} | ||
| Line 1,369: | Line 1,300: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| − | forward(63); | + | forward(63); // move forward at speed 63 |
| − | untilRotations(3, | + | untilRotations(3, in3); /* wait until the quadrature encoder |
| − | + | in port in3 counts 3 rotations */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,383: | Line 1,314: | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilEncoderCounts</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">long </span><span class="bigCodeBasic">distance | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilEncoderCounts</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">long </span><span class="bigCodeBasic">distance</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,390: | Line 1,321: | ||
! style="border-style: solid; border-width: 0px 0px 0px 0px"| | ! style="border-style: solid; border-width: 0px 0px 0px 0px"| | ||
|- | |- | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File: | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:encoder_counts_vex_pic.png]] |
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the motor encoder counts match the desired value. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the motor encoder counts match the desired value. | ||
| − | Range: - | + | Range: -32,768 to +32,767 |
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 + interrupt (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,406: | Line 1,337: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|''distance'' | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''distance'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of encoder counts to reach.<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of encoder counts to reach.<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from<br />- | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from<br />-32,768 to +32,767 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The quadrature encoder to use.<br />(default: | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The quadrature encoder to use.<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
|} | |} | ||
| Line 1,433: | Line 1,351: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| − | forward(63); | + | forward(63); // move forward at speed 63 |
| − | untilEncoderCounts(990, | + | untilEncoderCounts(990, in3); /* wait until the quadrature encoder in |
| − | + | port in3 counts 990 encoder counts */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,448: | Line 1,366: | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">turnLEDOn</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">turnLEDOn</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in12</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,458: | Line 1,376: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Turn an LED in a specified digital port ON. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Turn an LED in a specified digital port ON. | ||
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 (and your names for them given in Motors and Sensors Setup.) |
| + | |||
| + | Sensor port must be set to "Digital Output". | ||
|- | |- | ||
|} | |} | ||
| Line 1,469: | Line 1,389: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The VEX LED to use.<br />(default: <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The VEX LED to use.<br />(default: <span class="codeStringsNums">in12</span>) |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,479: | Line 1,399: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| − | turnLEDOn(); // turn on LED in port | + | turnLEDOn(); // turn on LED in port in12 (default) |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,489: | Line 1,409: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| − | turnLEDOn( | + | turnLEDOn(in7); // turn on LED in port in7 |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,500: | Line 1,420: | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">turnLEDOff</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">turnLEDOff</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in12</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,510: | Line 1,430: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Turn an LED in a specified digital port OFF. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Turn an LED in a specified digital port OFF. | ||
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 (and your names for them given in Motors and Sensors Setup.) |
| + | |||
| + | Sensor port must be set to "Digital Output". | ||
|- | |- | ||
|} | |} | ||
| Line 1,521: | Line 1,443: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The VEX LED to use.<br />(default: <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The VEX LED to use.<br />(default: <span class="codeStringsNums">in12</span>) |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,531: | Line 1,453: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| − | turnLEDOff(); // turn off LED in port | + | turnLEDOff(); // turn off LED in port in12 (default) |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,541: | Line 1,463: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| − | turnLEDOff( | + | turnLEDOff(in7); // turn off LED in port in7 |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,564: | Line 1,486: | ||
Brightness Range: (off) 0 to 127 (bright) | Brightness Range: (off) 0 to 127 (bright) | ||
| − | Acceptable Ports: motor ports 1 through | + | Acceptable Ports: motor ports 1 through 8 (and your names for them given in Motors and Sensors Setup.) |
| − | NOTE | + | *NOTE* Brightness control only available in motor ports 1 through 8 when connected to a VEX Motor Controller 29. |
|- | |- | ||
|} | |} | ||
| Line 1,578: | Line 1,500: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|The VEX Flashlight to use.<br />(default: <span class="codeStringsNums">port4</span>) | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The VEX Flashlight to use.<br />(default: <span class="codeStringsNums">port4</span>) | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">port1</span> to <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">port1</span> to <span class="codeStringsNums">port8</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''brightness'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''brightness'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The level of brightness to<br />set the VEX Flashlight to.<br />(default: <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The level of brightness to<br />set the VEX Flashlight to.<br />(default: <span class="codeStringsNums">63</span>) |
| style="border-style: solid; border-width: 0px 0px 0px 0px"|Any whole integer amount from 0 to 127. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|Any whole integer amount from 0 to 127. | ||
|- | |- | ||
| Line 1,601: | Line 1,523: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| − | turnFlashlightOn( | + | turnFlashlightOn(port8, 127); // turn VEX Flashlight in port8 ON to full brightness [127] |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,622: | Line 1,544: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Turns a VEX Flashlight in a specfied motor port OFF. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Turns a VEX Flashlight in a specfied motor port OFF. | ||
| − | Acceptable Ports: motor ports 1 through | + | Acceptable Ports: motor ports 1 through 8 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
| Line 1,635: | Line 1,557: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|The VEX Flashlight to use.<br />(default: <span class="codeStringsNums">port4</span>) | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The VEX Flashlight to use.<br />(default: <span class="codeStringsNums">port4</span>) | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">port1</span> to <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">port1</span> to <span class="codeStringsNums">port8</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,654: | Line 1,576: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| − | turnFlashlightOff( | + | turnFlashlightOff(port8); // turn VEX Flashlight in port8 OFF |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
Latest revision as of 12:42, 30 April 2012
| The ROBOTC Natural Language Library aims at making learning and using text-based programming languages easier for beginners. The Natural Language Library is filled with commands that are both easy to use and easy to remember. Natural Language commands encompass entire robot behaviors into a single command.
Natural Language can be enabled in ROBOTC by going to the Robot menu, then Platform Type, and then by selecting one of the Natural Language options. |
|
| |||||||
Video
| This video explains the ROBOTC Natural Language:
|
Setup Functions
robotType
| void robotType(tRobotType type = none) | ||||||
| ||||||
| ||||||
| ||||||
|
Wait Functions
wait
| void wait(long waitTime = 1) | ||||||
| ||||||
| ||||||
| ||||||
|
waitInMilliseconds
| void waitInMilliseconds(long waitTime = 1000) | ||||||
| ||||||
| ||||||
| ||||||
|
Movement Functions
startMotor
| void startMotor(tMotor motorPort = port6, byte speed = 95) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
stopMotor
| void stopMotor(tMotor motorPort = port6) | ||||||
| ||||||
| ||||||
| ||||||
|
setServo
| void setServo(tMotor servoPort = port6, int position = 0) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
Robot Movement Functions
forward
| void forward(byte speed = 95) | ||||||
| ||||||
| ||||||
| ||||||
|
backward
| void backward(byte speed = -95) | ||||||
| ||||||
| ||||||
| ||||||
|
pointTurn
| void pointTurn(tDirections direction = right, byte speed = 95) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
swingTurn
| void swingTurn(tDirections direction = right, byte speed = 95) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
stop
| void stop() | ||||
| ||||
| ||||
|
moveStraightForTime
| void moveStraightForTime(long seconds, tSensors rightEncoderPort, tSensors leftEncoderPort) | ||||||||||||
| ||||||||||||
| ||||||||||||
|
moveStraightForRotations
| void moveStraightForRotations(long rotations, tSensors rightEncoderPort, tSensors leftEncoderPort) | ||||||||||||
| ||||||||||||
| ||||||||||||
|
Until Functions
untilTouch
| void untilTouch(tSensors sensorPort) | ||||||
| ||||||
| ||||||
|
untilRelease
| void untilRelease(tSensors sensorPort) | ||||||
| ||||||
| ||||||
|
untilBump
| void untilBump(tSensors sensorPort, int delayTimeMS = 10) | |||||||||
| |||||||||
| |||||||||
|
untilSonarGreaterThan
| void untilSonarGreaterThan(short distance, tSensors sensorPort) | |||||||||
| |||||||||
| |||||||||
|
untilSonarLessThan
| void untilSonarLessThan(short distance, tSensors sensorPort) | |||||||||
| |||||||||
| |||||||||
|
untilPotentiometerGreaterThan
| void untilPotentiometerGreaterThan(int position, tSensors sensorPort) | |||||||||
| |||||||||
| |||||||||
|
untilPotentiometerLessThan
| void untilPotentiometerLessThan(int position, tSensors sensorPort) | |||||||||
| |||||||||
| |||||||||
|
untilButtonPress
| void untilButtonPress(short button = centerBtnVEX) | ||||||
| ||||||
| ||||||
| ||||||
|
untilLight
| void untilLight(int threshold, tSensors sensorPort) | |||||||||
| |||||||||
| |||||||||
|
untilDark
| void untilDark(int threshold, tSensors sensorPort) | |||||||||
| |||||||||
| |||||||||
|
untilRotations
| void untilRotations(float rotations, tSensors sensorPort) | |||||||||
| |||||||||
| |||||||||
|
untilEncoderCounts
| void untilEncoderCounts(long distance, tSensors sensorPort) | |||||||||
| |||||||||
| |||||||||
|
Special Functions
turnLEDOn
| void turnLEDOn(tSensors sensorPort = in12) | ||||||
| ||||||
| ||||||
| ||||||
|
turnLEDOff
| void turnLEDOff(tSensors sensorPort = in12) | ||||||
| ||||||
| ||||||
| ||||||
|
turnFlashlightOn
| void turnFlashlightOn(tMotor flashlightPort = port4, short brightness = 63) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
turnFlashlightOff
| void turnFlashlightOff(tMotor flashlightPort = port4) | ||||||
| ||||||
| ||||||
| ||||||
|




























