|
|
| Line 1,314: |
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</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> | + | | 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,324: |
Line 1,324: |
| | | 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: -2,147,483,648 to +2,147,483,647 | + | Range: -32,768 to +32,767 |
| | | | |
| − | Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.) | + | Acceptable Sensors: A/D ports 1 through 16 + interrupt (and your names for them given in Motors and Sensors Setup.) |
| | |- | | |- |
| | |} | | |} |
| Line 1,337: |
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: <span class="codeStringsNums">360</span>) | + | | 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 />-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 />-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: <span class="codeStringsNums">dgtl1</span> [+ <span class="codeStringsNums">dgtl1</span>]) | + | | 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">dgtl1</span> to <span class="codeStringsNums">dgtl11</span><br />Or their names setup in Motors and Sensors Setup. | + | | 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"|Default Usage and Sample
| + | |
| − | |-
| + | |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC">
| + | |
| − | forward();
| + | |
| − | untilEncoderCounts(); /* wait until the quadrature encoder in port
| + | |
| − | dgtl1 (+ dgtl2) counts 360 encoder counts (default) */
| + | |
| − | stop();
| + | |
| − | </syntaxhighlight>
| + | |
| | |- | | |- |
| | |} | | |} |
| Line 1,364: |
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); // move forward at speed 63 | + | forward(63); // move forward at speed 63 |
| − | untilEncoderCounts(990, dgtl3); /* wait until the quadrature encoder in port | + | untilEncoderCounts(990, in3); /* wait until the quadrature encoder in |
| − | dgtl3 (+ dgtl4)counts 990 encoder counts */
| + | port in3 counts 990 encoder counts */ |
| − | stop(); // stop | + | stop(); // stop |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | |- | | |- |