VEX2 Natural Language
(→untilBump) |
(→turnFlashlightOn) |
||
| (42 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | <yambe:breadcrumb self="Natural Language">VEX2|CORTEX</yambe:breadcrumb> | |
| − | + | <br /> | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | {| | |
| − | {| | + | |
|- | |- | ||
|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. | |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. | ||
| Line 14: | Line 9: | ||
|- | |- | ||
|} | |} | ||
| + | <br /> | ||
| − | { | + | {{tl|1|1}} |
| − | + | <br /> | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
== Video == | == Video == | ||
| Line 42: | Line 24: | ||
== Setup Functions == | == Setup Functions == | ||
| − | + | === robotType === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 97: | Line 79: | ||
== Wait Functions == | == Wait Functions == | ||
| − | + | === wait === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 107: | Line 89: | ||
! 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:wait_seconds.png]] |
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Wait an amount of time measured in seconds. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Wait an amount of time measured in seconds. | ||
|- | |- | ||
| Line 126: | Line 108: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.#### | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.#### | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.0000 to +2,048.0000 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.### | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.### | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.000 to +32,768.000 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.## | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.## | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.00 to +262,144.00 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.# | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.# | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.0 to +2,097,200.0 |
|- | |- | ||
|} | |} | ||
| Line 168: | Line 150: | ||
<br /> | <br /> | ||
| − | + | === waitInMilliseconds === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 178: | Line 160: | ||
! 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:wait_milliseconds.png]] |
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Wait an amount of time measured in milliseconds. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Wait an amount of time measured in milliseconds. | ||
|- | |- | ||
| Line 191: | Line 173: | ||
| style="border-style: solid; border-width: 1px 0px 0px 0px"|''waitTime'' | | style="border-style: solid; border-width: 1px 0px 0px 0px"|''waitTime'' | ||
| style="border-style: solid; border-width: 1px 0px 0px 0px"|Amount of time to wait, in seconds.<br />(default: <span class="codeStringsNums">1000</span>) | | style="border-style: solid; border-width: 1px 0px 0px 0px"|Amount of time to wait, in seconds.<br />(default: <span class="codeStringsNums">1000</span>) | ||
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|Any | + | | style="border-style: solid; border-width: 1px 0px 0px 0px"|Any integer amount from<br />0 to +2,147,483,647. |
|- | |- | ||
|} | |} | ||
| Line 223: | Line 205: | ||
== Movement Functions == | == Movement Functions == | ||
| − | + | === startMotor === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 286: | Line 268: | ||
<br /> | <br /> | ||
| − | + | === stopMotor === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 343: | Line 325: | ||
<br /> | <br /> | ||
| − | + | === setServo === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 403: | Line 385: | ||
== Robot Movement Functions == | == Robot Movement Functions == | ||
| − | + | === forward === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 460: | Line 442: | ||
<br /> | <br /> | ||
| − | + | === backward === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 517: | Line 499: | ||
<br /> | <br /> | ||
| − | + | === pointTurn === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 577: | Line 559: | ||
<br /> | <br /> | ||
| − | + | === swingTurn === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 637: | Line 619: | ||
<br /> | <br /> | ||
| − | + | === stop === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 679: | Line 661: | ||
<br /> | <br /> | ||
| − | + | === lineTrackForTime === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 712: | Line 694: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.#### | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.#### | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.0000 to +2,048.0000 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.### | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.### | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.000 to +32,768.000 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.## | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.## | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.00 to +262,144.00 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.# | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.# | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.0 to +2,097,200.0 |
|- | |- | ||
|} | |} | ||
| Line 774: | Line 756: | ||
<br /> | <br /> | ||
| − | + | === lineTrackForRotations === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 869: | Line 851: | ||
<br /> | <br /> | ||
| − | + | === moveStraightForTime === | |
{| 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">moveStraightForTime</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">float </span><span class="bigCodeBasic">seconds</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">5.0</span><span class="bigCodePunc">, </span><span class="bigCodeBasic"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">moveStraightForTime</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">float </span><span class="bigCodeBasic">seconds</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">5.0</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">rightEncoderPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">dgtl1</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">leftEncoderPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">dgtl3</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 902: | Line 884: | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.#### | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.#### | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.0000 to +2,048.0000 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.### | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.### | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.000 to +32,768.000 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.## | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.## | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.00 to +262,144.00 |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|0.# | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.# | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"| | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.0 to +2,097,200.0 |
|- | |- | ||
|} | |} | ||
| Line 954: | Line 936: | ||
<br /> | <br /> | ||
| − | + | === moveStraightForRotations === | |
{| 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">moveStraightForRotations</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">float </span><span class="bigCodeBasic">rotations</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">1.0</span><span class="bigCodePunc">, </span><span class="bigCodeBasic"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">moveStraightForRotations</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">float </span><span class="bigCodeBasic">rotations</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">1.0</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">rightEncoderPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">dgtl1</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">leftEncoderPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">dgtl3</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,039: | Line 1,021: | ||
<br /> | <br /> | ||
| − | + | === tankControl === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 1,111: | Line 1,093: | ||
<br /> | <br /> | ||
| − | + | === arcadeControl === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 1,184: | Line 1,166: | ||
== Until Functions == | == Until Functions == | ||
| − | + | === untilTouch === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 1,208: | Line 1,190: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 1px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|The sensor port to use for the | + | | style="border-style: solid; border-width: 1px 0px 0px 0px"|The sensor port to use for the touch sensor.<br />(default: <span class="codeStringsNums">dgtl6</span>) |
| style="border-style: solid; border-width: 1px 0px 0px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. | | style="border-style: solid; border-width: 1px 0px 0px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. | ||
|- | |- | ||
| Line 1,240: | Line 1,222: | ||
<br /> | <br /> | ||
| − | + | === untilRelease === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 1,264: | Line 1,246: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 0px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 1px 0px 0px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|The sensor port to use for the | + | | style="border-style: solid; border-width: 1px 0px 0px 0px"|The sensor port to use for the touch sensor.<br />(default: <span class="codeStringsNums">dgtl6</span>) |
| style="border-style: solid; border-width: 1px 0px 0px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. | | style="border-style: solid; border-width: 1px 0px 0px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. | ||
|- | |- | ||
| Line 1,296: | Line 1,278: | ||
<br /> | <br /> | ||
| − | + | === untilBump === | |
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| Line 1,323: | Line 1,305: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|''sensorPort'' | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''sensorPort'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The sensor port to use for the | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The sensor port to use for the touch sensor.<br />(default: <span class="codeStringsNums">dgtl6</span>) |
| style="border-style: solid; border-width: 1px 0px 1px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. | | style="border-style: solid; border-width: 1px 0px 1px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. | ||
|- | |- | ||
| Line 1,361: | Line 1,343: | ||
<br /> | <br /> | ||
| − | + | === untilSonarGreaterThan === | |
{| 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">untilSonarGreaterThan</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">distance</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">30</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">untilSonarGreaterThan</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">distance</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">30</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">dgtl8</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,371: | Line 1,353: | ||
! 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:sonar_greater_vex.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 sonar sensor reads a value greater than a set distance in centimeters. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the sonar sensor reads a value greater than a set distance in centimeters. | ||
| − | Range: 0 to | + | Range: 0 to 647 (A value of -1 means it cannot detect anything.) |
| − | Acceptable Sensors: | + | Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,388: | Line 1,370: | ||
| 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 distance in centimeters that<br />an object must be farther than to count<br />(default: <span class="codeStringsNums">30</span>) | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The distance in centimeters that<br />an object must be farther than to count<br />(default: <span class="codeStringsNums">30</span>) | ||
| − | | 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 647. |
|- | |- | ||
| 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: <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: <span class="codeStringsNums">dgtl8</span> [+ <span class="codeStringsNums">dgtl9</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">dgtl1</span> to <span class="codeStringsNums">dgtl11</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,402: | Line 1,384: | ||
| 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(); | forward(); | ||
| − | untilSonarGreaterThan(); /* wait until the sonar sensor in port | + | untilSonarGreaterThan(); /* wait until the sonar sensor in port dgtl8 (+ dgtl9) |
| − | an object farther than 30cm away (default) */ | + | detects an object farther than 30cm away (default) */ |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,414: | Line 1,396: | ||
|- | |- | ||
| 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); // go forward at speed 63 |
| − | untilSonarGreaterThan(45, | + | untilSonarGreaterThan(45, dgtl2); /* wait until the sonar sensor in port dgtl2 (+ dgtl3) |
| − | + | detects an object farther than 45cm away */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,425: | Line 1,407: | ||
<br /> | <br /> | ||
| − | + | === untilSonarLessThan === | |
{| 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">untilSonarLessThan</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">distance</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">30</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">untilSonarLessThan</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">distance</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">30</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">dgtl8</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,435: | Line 1,417: | ||
! 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:sonar_less_vex.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 sonar sensor reads a value less than a set distance in centimeters. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the sonar sensor reads a value less than a set distance in centimeters. | ||
| − | Range: 0 to | + | Range: 0 to 647 (A value of -1 means it cannot detect anything.) |
| − | Acceptable Sensors: | + | Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,451: | Line 1,433: | ||
|- | |- | ||
| 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 distance in centimeters that<br />an object must be | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The distance in centimeters that<br />an object must be farther than to count<br />(default: <span class="codeStringsNums">30</span>) |
| − | | 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 647. |
|- | |- | ||
| 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: <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: <span class="codeStringsNums">dgtl8</span> [+ <span class="codeStringsNums">dgtl9</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">dgtl1</span> to <span class="codeStringsNums">dgtl11</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,466: | Line 1,448: | ||
| 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(); | forward(); | ||
| − | untilSonarLessThan(); /* wait until the sonar sensor in port | + | untilSonarLessThan(); /* wait until the sonar sensor in port dgtl8 (+ dgtl 9) |
| − | an object closer than 30cm away (default) */ | + | detects an object closer than 30cm away (default) */ |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,478: | Line 1,460: | ||
|- | |- | ||
| 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); // go forward at speed 63 |
| − | untilSonarLessThan(45, | + | untilSonarLessThan(45, dgtl2); /* wait until the sonar sensor in port dgtl2 (+ dgtl3) |
| − | + | detects an object closer than 45cm away */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,489: | Line 1,471: | ||
<br /> | <br /> | ||
| − | === | + | === untilPotentiometerGreaterThan === |
{| 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"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilPotentiometerGreaterThan</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">position</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">2048</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in6</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,499: | Line 1,481: | ||
! 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:pot_greater_vex.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 potentiometer sensor reads a value greater than a set position. |
| − | Range: | + | Range: 0 to 4095 (However due to mechanical stops, you may be limited to the range of 5 to 4090.) |
| − | Acceptable Sensors: | + | Acceptable Sensors: analog ports 1 through 8 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,514: | Line 1,496: | ||
! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input | ||
|- | |- | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|'' | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''position'' |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The function passes if the rotation<br />is greater than this value<br />(default: <span class="codeStringsNums">2048</span>) |
| − | | 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 4095. |
|- | |- | ||
| 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: <span class="codeStringsNums">in6</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">in8</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,530: | Line 1,512: | ||
| 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(); | forward(); | ||
| − | + | untilPotentiometerGreaterThan(); /* wait until the potentiometer in port in6 | |
| − | + | reads a value greater than 2048 (default) */ | |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,542: | Line 1,524: | ||
|- | |- | ||
| 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); // go forward at speed 63 |
| − | + | untilPotentiometerGreaterThan(40, in4); /* wait until the potentiometer in port in4 | |
| − | + | reads a value greater than 40 (default) */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,553: | Line 1,535: | ||
<br /> | <br /> | ||
| − | === | + | === untilPotentiometerLessThan === |
{| 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"> | + | | 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="bigCodeStringsNums">2048</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in6</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,563: | Line 1,545: | ||
! 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:pot_less_vex.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 potentiometer sensor reads a value less than a set position. |
| − | Range: | + | Range: 0 to 4095 (However due to mechanical stops, you may be limited to the range of 5 to 4090.) |
| − | Acceptable Sensors: | + | Acceptable Sensors: analog ports 1 through 8 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,578: | Line 1,560: | ||
! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input | ||
|- | |- | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|'' | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''position'' |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The function passes if the rotation<br />is less than this value<br />(default: <span class="codeStringsNums">2048</span>) |
| − | | 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 4095. |
|- | |- | ||
| 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: <span class="codeStringsNums">in6</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">in8</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,594: | 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"> | ||
forward(); | forward(); | ||
| − | + | untilPotentiometerLessThan(); /* wait until the potentiometer in port in6 | |
| − | + | reads a value less than 2048 (default) */ | |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,606: | Line 1,588: | ||
|- | |- | ||
| 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); // go forward at speed 63 |
| − | + | untilPotentiometerLessThan(40, in4); /* wait until the potentiometer in port in4 | |
| − | + | reads a value less than 40 (default) */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,617: | Line 1,599: | ||
<br /> | <br /> | ||
| − | + | === untilButtonPress === | |
{| 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">untilButtonPress</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">button</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilButtonPress</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">button</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">centerBtnVEX</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,627: | Line 1,609: | ||
! 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:press_right_vex.png]] |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until a button on the | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until a button on the LCD is pressed. |
Acceptable Buttons: | Acceptable Buttons: | ||
| − | + | centerBtnVEX, rightBtnVEX, leftBtnVEX | |
|- | |- | ||
|} | |} | ||
| Line 1,642: | Line 1,624: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 0px 0px"|''button'' | | style="border-style: solid; border-width: 1px 0px 0px 0px"|''button'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|The button to press.<br />(default: <span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 1px 0px 0px 0px"|The button to press.<br />(default: <span class="codeStringsNums">centerBtnVEX</span>) |
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|<span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 1px 0px 0px 0px"|<span class="codeStringsNums">centerBtnVEX<br />rightBtnVEX<br />leftBtnVEX<br /></span> |
|- | |- | ||
|} | |} | ||
| Line 1,654: | Line 1,636: | ||
forward(); | forward(); | ||
untilButtonPress(); /* wait until the center button | untilButtonPress(); /* wait until the center button | ||
| − | is pressed on the | + | is pressed on the VEX LCD (default) */ |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,666: | Line 1,648: | ||
| 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); // go forward at speed 63 | forward(63); // go forward at speed 63 | ||
| − | untilButtonPress( | + | untilButtonPress(rightBtnVEX); /* wait until the right button |
| − | is pressed on the | + | is pressed on the VEX LCD */ |
stop(); // stop | stop(); // stop | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,676: | Line 1,658: | ||
<br /> | <br /> | ||
| − | + | === untilLight === | |
{| 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</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums"> | + | | 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="bigCodeStringsNums">505</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in2</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,686: | Line 1,668: | ||
! 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:until_light_vex.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 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 4095 (dark) |
| − | Acceptable Sensors: | + | Acceptable Sensors: analog ports 1 through 8 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,702: | Line 1,684: | ||
|- | |- | ||
| 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: <span class="codeStringsNums"> | + | | 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: <span class="codeStringsNums">505</span>) |
| − | | 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 4095. |
|- | |- | ||
| 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: <span class="codeStringsNums">in2</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">in8</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,717: | Line 1,699: | ||
| 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(); | forward(); | ||
| − | untilLight(); /* wait until the light sensor in port | + | untilLight(); /* wait until the light sensor in port in2 |
| − | detects an object lighter than | + | detects an object lighter than 505 (default) */ |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,729: | Line 1,711: | ||
|- | |- | ||
| 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); // go forward at speed 63 |
| − | untilLight( | + | untilLight(1005, in4); /* wait until the light sensor in port in4 |
| − | + | detects an object lighter than 1005 */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,740: | Line 1,722: | ||
<br /> | <br /> | ||
| − | + | === untilDark === | |
{| 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</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums"> | + | | 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="bigCodeStringsNums">505</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in2</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,750: | Line 1,732: | ||
! 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:until_dark_vex.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 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 4095 (dark) |
| − | Acceptable Sensors: | + | Acceptable Sensors: analog ports 1 through 8 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,766: | Line 1,748: | ||
|- | |- | ||
| 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: <span class="codeStringsNums"> | + | | 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: <span class="codeStringsNums">505</span>) |
| − | | 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 4095. |
|- | |- | ||
| 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: <span class="codeStringsNums">in2</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">in8</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,781: | Line 1,763: | ||
| 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(); | forward(); | ||
| − | untilDark(); /* wait until the light sensor in port | + | untilDark(); /* wait until the light sensor in port in2 |
| − | detects an object darker than | + | detects an object darker than 505 (default) */ |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,793: | Line 1,775: | ||
|- | |- | ||
| 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); // go forward at speed 63 |
| − | untilDark( | + | untilDark(1005, in4); /* wait until the light sensor in port in4 |
| − | + | detects an object darker than 1005 */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,804: | Line 1,786: | ||
<br /> | <br /> | ||
| − | + | === untilRotations === | |
{| 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</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">1.0</span><span class="bigCodePunc">, </span><span class=" | + | | 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="bigCodeStringsNums">1.0</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">dgtl1</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,814: | Line 1,796: | ||
! 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.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 rotations 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 rotations match the desired value. | ||
Range: -262,144.00 to +262,144.00 | Range: -262,144.00 to +262,144.00 | ||
| − | Acceptable | + | Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,850: | Line 1,832: | ||
|} | |} | ||
|- | |- | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|'' | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The quadrature encoder to use.<br />(default: <span class="codeStringsNums">dgtl1</span> [+ <span class="codeStringsNums">dgtl1</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">dgtl1</span> to <span class="codeStringsNums">dgtl11</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,862: | Line 1,844: | ||
| 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(); | forward(); | ||
| − | untilRotations(); /* wait until the | + | untilRotations(); /* wait until the quadrature encoder in port |
| − | + | dgtl1 (+ dgtl2) counts 1.0 rotations (default) */ | |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,875: | Line 1,857: | ||
| 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); // move forward at speed 63 | forward(63); // move forward at speed 63 | ||
| − | untilRotations(2. | + | untilRotations(2.75, dgtl3); /* wait until the quadrature encoder in port |
| − | + | dgtl3 (+ dgtl4) counts 2.75 rotations */ | |
stop(); // stop | stop(); // stop | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,885: | Line 1,867: | ||
<br /> | <br /> | ||
| − | + | === untilEncoderCounts === | |
{| 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</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">360</span><span class="bigCodePunc">, </span><span class=" | + | | 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="bigCodeStringsNums">360</span><span class="bigCodePunc">, </span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">dgtl1</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,895: | Line 1,877: | ||
! 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.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 | + | | 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: -2,147,483,648 to +2,147,483,647 | + | Range: -2,147,483,648 to +2,147,483,647 |
| − | Acceptable | + | Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,912: | Line 1,894: | ||
| 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: <span class="codeStringsNums">360</span>) | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of encoder counts to reach.<br />(default: <span class="codeStringsNums">360</span>) | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from<br />-2,147,483,648 to +2,147,483,647 | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any whole integer amount from<br />-2,147,483,648 to +2,147,483,647 |
|- | |- | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|'' | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The quadrature encoder to use.<br />(default: <span class="codeStringsNums">dgtl1</span> [+ <span class="codeStringsNums">dgtl1</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">dgtl1</span> to <span class="codeStringsNums">dgtl11</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
|} | |} | ||
| Line 1,926: | Line 1,908: | ||
| 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(); | forward(); | ||
| − | untilEncoderCounts(); /* wait until the | + | untilEncoderCounts(); /* wait until the quadrature encoder in port |
| − | + | dgtl1 (+ dgtl2) counts 360 encoder counts (default) */ | |
stop(); | stop(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 1,939: | Line 1,921: | ||
| 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); // move forward at speed 63 | forward(63); // move forward at speed 63 | ||
| − | untilEncoderCounts(990, | + | untilEncoderCounts(990, dgtl3); /* wait until the quadrature encoder in port |
| − | + | dgtl3 (+ dgtl4) counts 990 encoder counts */ | |
stop(); // stop | stop(); // stop | ||
| + | </syntaxhighlight> | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | |} | ||
| + | <br /> | ||
| + | |||
| + | == Special Functions == | ||
| + | === turnLEDOn === | ||
| + | {| 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">dgtl2</span><span class="bigCodePunc">)</span> | ||
| + | |- | ||
| + | | | ||
| + | {| 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"| | ||
| + | ! style="border-style: solid; border-width: 0px 0px 0px 0px"| | ||
| + | |- | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:led_on.png]] | ||
| + | | 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: digital ports 1 through 12 (and your names for them given in Motors and Sensors Setup.) | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | | | ||
| + | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#F2F2F2; 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 1px 0px"|Parameter | ||
| + | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation | ||
| + | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input | ||
| + | |- | ||
| + | | 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">dgtl2</span>) | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</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"|Default Usage and Sample | ||
| + | |- | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| + | turnLEDOn(); // turn on LED in port dgtl1 (default) | ||
| + | </syntaxhighlight> | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | | | ||
| + | {| 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"|<syntaxhighlight lang="ROBOTC"> | ||
| + | turnLEDOn(dgtl7); // turn on LED in port dgtl7 | ||
| + | </syntaxhighlight> | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | |} | ||
| + | <br /> | ||
| + | |||
| + | === turnLEDOff === | ||
| + | {| 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">dgtl2</span><span class="bigCodePunc">)</span> | ||
| + | |- | ||
| + | | | ||
| + | {| 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"| | ||
| + | ! style="border-style: solid; border-width: 0px 0px 0px 0px"| | ||
| + | |- | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:led_off.png]] | ||
| + | | 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: digital ports 1 through 12 (and your names for them given in Motors and Sensors Setup.) | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | | | ||
| + | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#F2F2F2; 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 1px 0px"|Parameter | ||
| + | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation | ||
| + | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input | ||
| + | |- | ||
| + | | 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">dgtl2</span>) | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</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"|Default Usage and Sample | ||
| + | |- | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| + | turnLEDOff(); // turn off LED in port dgtl1 (default) | ||
| + | </syntaxhighlight> | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | | | ||
| + | {| 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"|<syntaxhighlight lang="ROBOTC"> | ||
| + | turnLEDOff(dgtl7); // turn off LED in port dgtl7 | ||
| + | </syntaxhighlight> | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | |} | ||
| + | <br /> | ||
| + | |||
| + | === turnFlashlightOn === | ||
| + | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
| + | |- | ||
| + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">turnFlashlightOn</span><span class="bigCodePunc">(</span><span class="bigCodeBasic">tMotor </span><span class="bigCodeBasic">flashlightPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">port4</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">brightness</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">63</span><span class="bigCodePunc">)</span> | ||
| + | |- | ||
| + | | | ||
| + | {| 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"| | ||
| + | ! style="border-style: solid; border-width: 0px 0px 0px 0px"| | ||
| + | |- | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:flashlight_on.png]] | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) Turns a VEX Flashlight in a specfied motor port ON at a specified brightness. | ||
| + | |||
| + | Brightness Range: (off) 0 to 127 (bright) | ||
| + | |||
| + | Acceptable Ports: motor ports 1 through 10 (and your names for them given in Motors and Sensors Setup.) | ||
| + | |||
| + | NOTE: Brightness control only available in motor ports 1 and 10, or 2 through 9 when connected to a VEX Motor Controller 29. | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | | | ||
| + | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#F2F2F2; 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 1px 0px"|Parameter | ||
| + | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation | ||
| + | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input | ||
| + | |- | ||
| + | | 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"|<span class="codeStringsNums">port1</span> to <span class="codeStringsNums">port10</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"|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="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"|Default Usage and Sample | ||
| + | |- | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| + | turnFlashlightOn(); // turn VEX Flashlight in port4 ON to half brightness [63] (default) | ||
| + | </syntaxhighlight> | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | | | ||
| + | {| 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"|<syntaxhighlight lang="ROBOTC"> | ||
| + | turnFlashlightOn(port10, 127); // turn VEX Flashlight in port10 ON to full brightness [127] | ||
| + | </syntaxhighlight> | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | |} | ||
| + | <br /> | ||
| + | |||
| + | === turnFlashlightOff === | ||
| + | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
| + | |- | ||
| + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">turnFlashlightOff</span><span class="bigCodePunc">(</span><span class="bigCodeBasic">tMotor </span><span class="bigCodeBasic">flashlightPort</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">port4</span><span class="bigCodePunc">)</span> | ||
| + | |- | ||
| + | | | ||
| + | {| 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"| | ||
| + | ! style="border-style: solid; border-width: 0px 0px 0px 0px"| | ||
| + | |- | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:flashlight_off.png]] | ||
| + | | 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 10 (and your names for them given in Motors and Sensors Setup.) | ||
| + | |||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | | | ||
| + | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#F2F2F2; 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 1px 0px"|Parameter | ||
| + | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation | ||
| + | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input | ||
| + | |- | ||
| + | | 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"|<span class="codeStringsNums">port1</span> to <span class="codeStringsNums">port10</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"|Default Usage and Sample | ||
| + | |- | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC"> | ||
| + | turnFlashlightOff(); // turn VEX Flashlight in port4 OFF (default) | ||
| + | </syntaxhighlight> | ||
| + | |- | ||
| + | |} | ||
| + | |- | ||
| + | | | ||
| + | {| 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"|<syntaxhighlight lang="ROBOTC"> | ||
| + | turnFlashlightOff(port10); // turn VEX Flashlight in port10 OFF | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
Latest revision as of 12:41, 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(float waitTime = 1.0) | ||||||||||||||||
| ||||||||||||||||
| ||||||||||||||||
| ||||||||||||||||
|
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() | ||||
| ||||
| ||||
|
lineTrackForTime
| void lineTrackForTime(float trackTime = 5.0, int threshold = 505, tSensors sensorLeft = in1, tSensors sensorCenter = in2, tSensors sensorRight = in3) | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
|
lineTrackForRotations
| void lineTrackForRotations(float rotations = 3.0, int threshold = 505, tSensors sensorLeft = in1, tSensors sensorCenter = in2, tSensors sensorRight = in3) | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
|
moveStraightForTime
| void moveStraightForTime(float seconds = 5.0, tSensors rightEncoderPort = dgtl1, tSensors leftEncoderPort = dgtl3) | ||||||||||||||||||||||
| ||||||||||||||||||||||
| ||||||||||||||||||||||
| ||||||||||||||||||||||
|
moveStraightForRotations
| void moveStraightForRotations(float rotations = 1.0, tSensors rightEncoderPort = dgtl1, tSensors leftEncoderPort = dgtl3) | ||||||||||||||||||||||
| ||||||||||||||||||||||
| ||||||||||||||||||||||
| ||||||||||||||||||||||
|
tankControl
| void tankControl(TVexJoysticks rightJoystick = Ch2, TVexJoysticks leftJoystick = Ch3, short threshold = 10) | ||||||||||||
| ||||||||||||
| ||||||||||||
| ||||||||||||
|
arcadeControl
| void arcadeControl(TVexJoysticks verticalJoystick = Ch2, TVexJoysticks horizontalJoystick = Ch1, short threshold = 10) | ||||||||||||
| ||||||||||||
| ||||||||||||
| ||||||||||||
|
Until Functions
untilTouch
| void untilTouch(tSensors sensorPort = dgtl6) | ||||||
| ||||||
| ||||||
| ||||||
|
untilRelease
| void untilRelease(tSensors sensorPort = dgtl6) | ||||||
| ||||||
| ||||||
| ||||||
|
untilBump
| void untilBump(tSensors sensorPort = dgtl6, int delayTimeMS = 10) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
untilSonarGreaterThan
| void untilSonarGreaterThan(short distance = 30, tSensors sensorPort = dgtl8) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
untilSonarLessThan
| void untilSonarLessThan(short distance = 30, tSensors sensorPort = dgtl8) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
untilPotentiometerGreaterThan
| void untilPotentiometerGreaterThan(int position = 2048, tSensors sensorPort = in6) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
untilPotentiometerLessThan
| void untilPotentiometerLessThan(int position = 2048, tSensors sensorPort = in6) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
untilButtonPress
| void untilButtonPress(short button = centerBtnVEX) | ||||||
| ||||||
| ||||||
| ||||||
|
untilLight
| void untilLight(int threshold = 505, tSensors sensorPort = in2) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
untilDark
| void untilDark(int threshold = 505, tSensors sensorPort = in2) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
untilRotations
| void untilRotations(float rotations = 1.0, tSensors sensorPort = dgtl1) | |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
|
untilEncoderCounts
| void untilEncoderCounts(long distance = 360, tSensors sensorPort = dgtl1) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
Special Functions
turnLEDOn
| void turnLEDOn(tSensors sensorPort = dgtl2) | ||||||
| ||||||
| ||||||
| ||||||
|
turnLEDOff
| void turnLEDOff(tSensors sensorPort = dgtl2) | ||||||
| ||||||
| ||||||
| ||||||
|
turnFlashlightOn
| void turnFlashlightOn(tMotor flashlightPort = port4, short brightness = 63) | |||||||||
| |||||||||
| |||||||||
| |||||||||
|
turnFlashlightOff
| void turnFlashlightOff(tMotor flashlightPort = port4) | ||||||
| ||||||
| ||||||
| ||||||
|
































