|
|
| Line 1,263: |
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</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> | + | | 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,271: |
Line 1,271: |
| | |- | | |- |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:rotations_vex.png]] | | | 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 quadrature encoder rotations match the desired value. Whole number values only! |
| | | | |
| − | Range: -262,144.00 to +262,144.00 | + | Range: 0 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,286: |
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: <span class="codeStringsNums">1.0</span>) | + | | 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 floating point amount: | | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any floating point amount: |
| | {| 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="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%" |
| void untilRotations(float rotations, tSensors sensorPort)
|
|
|
|
|
(void) The robot does what it was doing until the quadrature encoder rotations match the desired value. Whole number values only!
Range: 0 to 32,767
Acceptable Sensors: A/D ports 1 through 16 + interrupt (and your names for them given in Motors and Sensors Setup.)
|
|
| Parameter
|
Explanation
|
Acceptable Input
|
| rotations
|
The amount of axle rotations to reach. (default: none)
|
Any floating point amount:
|
|
|
| 0.####
|
-2,048.0000 to +2,048.0000
|
| 0.###
|
-32,768.000 to +32,768.000
|
| 0.##
|
-262,144.00 to +262,144.00
|
| 0.#
|
-2,097,200.0 to +2,097,200.0
|
|
| sensorPort
|
The quadrature encoder to use. (default: dgtl1 [+ dgtl1])
|
dgtl1 to dgtl11 Or their names setup in Motors and Sensors Setup.
|
|
| Default Usage and Sample
|
forward();
untilRotations(); /* wait until the quadrature encoder in port
dgtl1 (+ dgtl2) counts 1.0 rotations (default) */
stop();
|
|
| Usage and Sample with Parameters
|
forward(63); // move forward at speed 63
untilRotations(3, dgtl3); /* wait until the quadrature encoder in port
dgtl3 (+ dgtl4)counts 3 rotations */
stop(); // stop
|
|
| void untilEncoderCounts(long distance = 360, tSensors sensorPort = dgtl1)
|
|
|
|
|
(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
Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.)
|
|
| Parameter
|
Explanation
|
Acceptable Input
|
| distance
|
The amount of encoder counts to reach. (default: 360)
|
Any whole integer amount from -2,147,483,648 to +2,147,483,647
|
| sensorPort
|
The quadrature encoder to use. (default: dgtl1 [+ dgtl1])
|
dgtl1 to dgtl11 Or their names setup in Motors and Sensors Setup.
|
|
| Default Usage and Sample
|
forward();
untilEncoderCounts(); /* wait until the quadrature encoder in port
dgtl1 (+ dgtl2) counts 360 encoder counts (default) */
stop();
|
|
| Usage and Sample with Parameters
|
forward(63); // move forward at speed 63
untilEncoderCounts(990, dgtl3); /* wait until the quadrature encoder in port
dgtl3 (+ dgtl4)counts 990 encoder counts */
stop(); // stop
|
|