Motor Sensing#
Introduction#
The Motor Sensing category includes blocks that report the real-time state of VEX IQ (2nd gen) Motors or Motor Groups. These blocks provide data such as motion status, current velocity, distance traveled, and current draw. This information can be used to monitor robot behavior or build logic based on sensor feedback.
Below is a list of available blocks:
motor is done? – Returns a Boolean indicating whether the motor is no longer spinning.
motor is spinning? – Returns a Boolean indicating whether the motor is currently spinning.
motor position – Returns the motor’s current rotational position in degrees or turns.
motor velocity – Returns the motor’s current velocity in % or rpm.
motor current – Returns the current (in amps) drawn by the motor.
motor is done?#
The motor is done? block returns a Boolean indicating whether the motor is not spinning.
True - The motor is not spinning.
False - The motor is spinning.
<[Motor1 v] is done?>
Parameters |
Description |
---|---|
motor |
The motor or motor group to check, configured in the Devices window. |
Example
motor is spinning?#
The motor is spinning? block returns a Boolean indicating whether the motor is spinning.
True - The motor is spinning.
False - The motor is not spinning.
<[Motor1 v] is spinning?>
Parameters |
Description |
---|---|
motor |
The motor or motor group to check, configured in the Devices window. |
Example
motor position#
The motor position block returns the total distance the selected motor or motor group has rotated.
([Motor1 v] position in [degrees v])
Parameters |
Description |
---|---|
motor |
The motor or motor group to check, configured in the Devices window. |
unit |
The unit of measurement, which can be one of the following:
|
Example
when started :: hat events
[Spin Motor7 forward for 1 second.]
spin [Motor7 v] [forward v]
wait (1) seconds
[Print Motor7's current position in degrees.]
print ([Motor7 v] position in [degrees v]) on [Brain v] ▶
motor velocity#
The motor velocity block returns the current rotational speed of the motor or motor group in a range from -100% to 100% or -127 rpm to 127 rpm.
([Motor1 v] velocity in [% v])
Parameters |
Description |
---|---|
motor |
The motor or motor group to check, configured in the Devices window. |
unit |
The unit of measurement, which can be one of the following:
|
Example
when started :: hat events
[Spin Motor7 forward for 1 second.]
spin [Motor7 v] [forward v]
wait (1) seconds
[Print Motor7's current velocity in rpm.]
print ([Motor7 v] velocity in [rpm v]) on [Brain v] ▶
motor current#
The motor current block returns the amount of electrical current the motor or motor group in a range from 0.0 to 1.2 amps (amperes).
([Motor1 v] current in [amps v])
Parameters |
Description |
---|---|
motor |
The motor or motor group to check, configured in the Devices window. |
Example
when started :: hat events
[Spin Motor7 forward for 1 second.]
spin [Motor7 v] [forward v]
wait (1) seconds
[Print Motor7's current current in amps.]
print ([Motor7 v] current in [amps v]) on [Brain v] ▶