VEX Natural Language
(→moveStraightForTime) |
(→turnLEDOn) |
||
| (40 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | <yambe:breadcrumb self="Natural Language">VEX|PIC</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 100: | Line 82: | ||
{| 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">wait</span><span class="bigCodePunc">(</span><span class="bigKeywordBI"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">wait</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">long </span><span class="bigCodeBasic">waitTime</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">1</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 259: | Line 241: | ||
|- | |- | ||
| 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"> | ||
| − | startMotor(port8, -32); | + | startMotor(port8, -32); // start port8 at speed -32 |
| − | + | waitInMilliseconds(500); // wait 0.5 seconds | |
| − | stopMotor(port8); | + | stopMotor(port8); // stop port8 |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 316: | Line 298: | ||
|- | |- | ||
| 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"> | ||
| − | startMotor(port8, -32); | + | startMotor(port8, -32); // start port8 at speed -32 |
| − | + | waitInMilliseconds(500); // wait 0.5 seconds | |
| − | stopMotor(port8); | + | stopMotor(port8); // stop port8 |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 434: | Line 416: | ||
| 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 | ||
| − | wait(2 | + | wait(2); // wait 2 seconds |
stop(); // stop | stop(); // stop | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 491: | Line 473: | ||
| 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"> | ||
backward(-63); // move backward at speed -63 | backward(-63); // move backward at speed -63 | ||
| − | wait(2 | + | wait(2); // wait 2 seconds |
stop(); // stop | stop(); // stop | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 550: | Line 532: | ||
|- | |- | ||
| 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"> | ||
| − | pointTurn(left, 63); | + | pointTurn(left, 63); // point turn LEFT at speed 63 |
| − | + | waitInMilliseconds(400); // wait 0.4 seconds | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 610: | Line 592: | ||
|- | |- | ||
| 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"> | ||
| − | swingTurn(left, 63); | + | swingTurn(left, 63); // swing turn LEFT at speed 63 |
| − | + | waitInMilliseconds(750); // wait 0.75 seconds | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 653: | Line 635: | ||
| 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 | ||
| − | wait(2 | + | wait(2); // wait 2 seconds |
stop(); // stop | stop(); // stop | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 665: | Line 647: | ||
{| 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"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">moveStraightForTime</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">long </span><span class="bigCodeBasic">seconds</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">rightEncoderPort</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">leftEncoderPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 688: | Line 670: | ||
|- | |- | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|''seconds'' | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''seconds'' | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of time in seconds to drive straight forward.<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of time in seconds to drive straight forward.<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 integer amount from<br />0 to +2,147,483,647. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 1px 0px"|''rightEncoderPort'' | | style="border-style: solid; border-width: 0px 0px 1px 0px"|''rightEncoderPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The right-side motor encoder.<br />(default: | + | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The right-side motor encoder.<br />(default: '''NONE''') |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|<span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 1px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''leftEncoderPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''leftEncoderPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The left-side motor encoder.<br />(default: | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The left-side motor encoder.<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 736: | Line 688: | ||
|- | |- | ||
| 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"> | ||
| − | moveStraightForTime(7 | + | moveStraightForTime(7, in5, in3); /* move straight forward for 7 seconds, |
| − | + | using in5 as the right-side encoder | |
| − | + | and in3 as the left-side encoder */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 750: | Line 702: | ||
{| 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"> | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">moveStraightForRotations</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">long </span><span class="bigCodeBasic">rotations</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">rightEncoderPort</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">leftEncoderPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 762: | Line 714: | ||
*NOTE: This function only supports moving forward and only at one speed setting. Future implementations may include moving backwards and variable speeds. | *NOTE: This function only supports moving forward and only at one speed setting. Future implementations may include moving backwards and variable speeds. | ||
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 + interrupts (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"|Parameter | ||
! style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation | ||
| Line 773: | Line 725: | ||
|- | |- | ||
| 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 drive straight forward.<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of axle rotations to drive straight forward.<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 integer amount from<br />0 to +2,147,483,647. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 1px 0px"|''rightEncoderPort'' | | style="border-style: solid; border-width: 0px 0px 1px 0px"|''rightEncoderPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The right-side motor encoder.<br />(default: | + | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The right-side motor encoder.<br />(default: '''NONE''') |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|<span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 0px 0px 1px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''leftEncoderPort'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''leftEncoderPort'' | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The left-side motor encoder.<br />(default: | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The left-side motor encoder.<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 821: | Line 743: | ||
|- | |- | ||
| 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"> | ||
| − | moveStraightForRotations(4 | + | moveStraightForRotations(4, in5, in3); /* move straight forward for 4 rotations, |
| − | + | using in5 as the right-side encoder | |
| − | + | and in3 as the left-side encoder */ | |
| − | stop(); | + | stop(); // stop |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 980: | Line 758: | ||
{| 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">untilTouch</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilTouch</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 990: | Line 768: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the touch sensor is pressed in. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the touch sensor is pressed in. | ||
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,001: | Line 779: | ||
|- | |- | ||
| 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: '''''none''''') |
| − | | 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">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
|} | |} | ||
| Line 1,023: | Line 789: | ||
|- | |- | ||
| 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 |
| − | untilTouch( | + | untilTouch(in10); // wait until the touch sensor in port in10 is pressed |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,036: | Line 802: | ||
{| 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">untilRelease</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilRelease</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,046: | Line 812: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the touch sensor is released. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the touch sensor is released. | ||
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,057: | Line 823: | ||
|- | |- | ||
| 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: '''''none''''') |
| − | | 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">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
|} | |} | ||
| Line 1,079: | Line 833: | ||
|- | |- | ||
| 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 |
| − | untilRelease( | + | untilRelease(in10); // wait until the touch sensor in port in10 is released |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,092: | Line 846: | ||
{| 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">untilBump</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">untilBump</span><span class="bigCodePunc">(</span><span class="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">delayTimeMS</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">10</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,102: | Line 856: | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the touch sensor is pressed in and then released out. A delay time in milliseconds can be specified. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot does what it was doing until the touch sensor is pressed in and then released out. A delay time in milliseconds can be specified. | ||
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 (and your names for them given in Motors and Sensors Setup.) |
Acceptable Range for Delay Time: | Acceptable Range for Delay Time: | ||
| − | 0 to | + | 0 to 32,767. |
|- | |- | ||
|} | |} | ||
| Line 1,116: | Line 870: | ||
|- | |- | ||
| 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 light sensor.<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The sensor port to use for the light sensor.<br />(default: '''''none''''') |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|<span class="codeStringsNums"> | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in16</span><br />Or their names setup in Motors and Sensors Setup. |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''delayTimeMS'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''delayTimeMS'' | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|The amount of milliseconds that MUST PASS between<br />press and release of the sensor for it to count.<br />(default: <span class="codeStringsNums">10</span>) | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The amount of milliseconds that MUST PASS between<br />press and release of the sensor for it to count.<br />(default: <span class="codeStringsNums">10</span>) | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|Any whole integer amount from<br />0 to | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|Any whole integer amount from<br />0 to 32,767. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|- | |- | ||
|} | |} | ||
| Line 1,143: | Line 884: | ||
|- | |- | ||
| 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 |
| − | untilBump( | + | untilBump(in10, 100); /* wait until the touch sensor in port in10 is pressed and |
| − | + | then released with a delay time of 100 milliseconds */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,157: | Line 898: | ||
{| 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 | + | | 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="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,167: | Line 908: | ||
| 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 255 (A value of -1 means it cannot detect anything.) |
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 + interrupt (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,180: | Line 921: | ||
|- | |- | ||
| 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: | + | | 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: '''''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 255. |
|- | |- | ||
| 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"> | + | | 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,207: | Line 935: | ||
|- | |- | ||
| 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, in2); /* wait until the sonar sensor in port in2 |
| − | + | detects an object farther than 45cm away */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,221: | Line 949: | ||
{| 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 | + | | 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="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,231: | Line 959: | ||
| 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 255 (A value of -1 means it cannot detect anything.) |
| − | Acceptable Sensors: | + | Acceptable Sensors: A/D ports 1 through 16 + interrupt (and your names for them given in Motors and Sensors Setup.) |
|- | |- | ||
|} | |} | ||
| Line 1,244: | Line 972: | ||
|- | |- | ||
| 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: | + | | 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: '''''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 255. |
|- | |- | ||
| 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"> | + | | 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,271: | Line 986: | ||
|- | |- | ||
| 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, in2); /* wait until the sonar sensor in port in2 |
| − | + | detects an object closer than 45cm away */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,285: | Line 1,000: | ||
{| 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">untilPotentiometerGreaterThan</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">position | + | | 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="bigKeywordB">tSensors </span><span class="bigCodeBasic">sensorPort</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| | | | ||
| Line 1,295: | Line 1,010: | ||
| 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. | | 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: 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,308: | Line 1,023: | ||
|- | |- | ||
| 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 greater than this value<br />(default: | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The function passes if the rotation<br />is greater 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,349: | 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,359: | 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,372: | 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,472: | 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,482: | 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,495: | 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,536: | 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,546: | 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,559: | 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,600: | 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,607: | 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,623: | 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,667: | 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( | + | untilRotations(3, in3); /* wait until the quadrature encoder |
| − | + | in port in3 counts 3 rotations */ | |
| − | stop(); | + | stop(); // stop |
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 1,681: | 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,688: | 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,704: | 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,731: | 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,746: | 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,756: | 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,767: | 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,777: | 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,787: | 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,798: | 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,808: | 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,819: | 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,829: | 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,839: | 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,862: | 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,876: | 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,899: | 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,920: | 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,933: | 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,952: | 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) | ||||||
| ||||||
| ||||||
| ||||||
|




























