Motor Rotation Block

The Motor Rotation block gets data from the Motor Rotation sensor that is built into the Medium Motor, Large Motor, and NXT Motors. You can measure how far a motor has turned in degrees or rotations. You can also get the current power level that a motor is running at.

The Motor Rotation block can also compare the rotation amount or power level to a Threshold Value to get a Logic (True or False) output.

See Using the Motor Rotation Sensor for more information about how the Motor Rotation sensor works, the data that it provides, and programming examples.
Tips and Tricks
The Motor Rotation block outputs data with a Data Wire. See Using the Motor Rotation Sensor for other ways to use a Motor Rotation sensor that don’t require a data wire.
Choose the Motor Port and Sensor Mode


Port Selector
Mode Selector
Inputs
Outputs

Use the Port Selector on the top of the block to select the motor port on the EV3 brick (A, B, C, or D) that the motor you want to measure is connected to. The Motor Rotation Block acts like a sensor, but it must be used with a motor connected to a motor port. It cannot be used with a sensor port.

Use the Mode Selector to select the mode for the block. The Inputs and Outputs available will change depending on the mode.
Modes
Measure – Degrees


The Measure – Degrees mode outputs the current motor rotation amount in the Degrees output. The motor rotation is measured in degrees, relative to the last time it was reset with the Reset mode.
Measure – Rotations


The Measure – Rotations mode outputs the current motor rotation amount in the Rotations output. The motor rotation is measured in rotations, relative to the last time it was reset with the Reset mode.
Measure – Current Power


The Measure – Current Power mode outputs the current power level of the motor in the Current Power output.
Compare Modes


The Compare modes compare the sensor data (Degrees, Rotations, or Power Level) to the Threshold Value using the selected Compare Type. The True/False result is output in Compare Result, and the sensor data is output in the chosen sensor data type.
Reset


The Reset mode resets the rotation amount to zero (0 degrees or rotations). Future measurements of the motor’s rotation amount using the Motor Rotation sensor will be measured relative to the reset position.

Resetting a Motor Rotation sensor has no effect on the power level or position of the motor. Only Motor Rotation sensor readings are affected.
Inputs and Outputs
The inputs available for the Motor Rotation block will depend on the mode selected. You can enter the input values directly into the block. Alternatively, the input values can be supplied by Data Wires from the outputs of other Programming Blocks.
InputTypeAllowed ValuesNotes
Compare Type Numeric0 - 50: = (Equal to)
1: ≠ (Not Equal to)
2: > (Greater than)
3: ≥ (Greater than or Equal to)
4: < (Less than)
5: ≤ (Less than or Equal to)
Threshold Value NumericAny numberValue to compare sensor data to
The outputs available will depend on the mode selected. To use an output, use a Data Wire to connect it to another Programming Block.
OutputTypeNotes
Degrees NumericRotation amount in degrees.
Measured from the last reset. Reset with the Reset mode.
Rotations NumericRotation amount in rotations.
Measured from the last reset. Reset with the Reset mode.
Current Power NumericCurrent motor power level (-100 to 100).
Compare Result LogicTrue/False result of a Compare mode.
Motor Rotation
Quick links