Motor55#
To make Motor55 commands appear in VEXcode V5, a Motor Controller 55 must be configured in the Devices window.
For more information, refer to these articles:
Initializing the Motor55 Class#
A Motor Controller 55, which is used to control a Direct Current (DC) Motor, is created by using the following constructor:
Motor55(port)
This constructor use two parameters:
Parameter |
Description |
---|---|
|
A valid Smart Port that the Distance Sensor is connected to. |
|
Optional. |
# Construct a Motor Controller 55 "m55_1" with the
# Motor55 class.
m55_1 = Motor55(Ports.PORT1)
This m55_1
object will be used in all subsequent examples throughout this API documentation when referring to Motor55 class methods.
Class Methods#
spin()#
The spin(direction, velocity, units)
command turns on the Motor and spins it in a specified direction and a specified voltage.
This is a non-waiting command and allows the next command to run without delay.
Parameters |
Description |
---|---|
direction |
The direction to spin the Motor. |
velocity |
Optional. Spin the Motor using this velocity, the default velocity set by the |
units |
Optional. A valid VelocityUnits. The default is |
Returns: None.
stop()#
The stop()
command stops the Motor using the default brake mode.
Returns: None.
set_reversed#
The set_reversed(value)
command sets the Motor mode to “reverse”, which will make Motor commands spin the Motor in the opposite direction.
Parameters |
Description |
---|---|
value |
If set to true, Motor commands spin the Motor in the opposite direction. |
Returns: None.
set_velocity()#
The set_velocity(velocity, units)
command sets the velocity of the Motor based on the parameters set in the command. This command will not run the Motor. Any subsequent call that does not contain a specified Motor velocity will use this value.
Parameters |
Description |
---|---|
velocity |
Sets the new velocity. |
units |
The units for the supplied velocity, the only valid unit is |
Returns: None.
set_stopping()#
The set_stopping(mode)
command sets the stopping mode of the Motor by passing a brake mode as a parameter.
Parameters |
Description |
---|---|
mode |
The stopping mode can be set to |
Returns: None.
set_max_torque()#
The set_max_torque(value, units)
command sets the max torque of the Motor.
Parameters |
Description |
---|---|
value |
Sets the amount of torque. |
units |
The unit for the torque value, only |
Returns: None.
current()#
The current(units)
command gets the electrical current of the Motor.
This is a non-waiting command and allows the next command to run without delay.
Parameters |
Description |
---|---|
units |
Optional. The measurement unit for the current. |
Returns: A double that represents the electrical current of the Motor in the units defined in the parameter.
get_max_voltage()#
The get_max_voltage()
command gets the maximum electrical voltage of the Motor corresponding to 100%.
Parameters |
Description |
---|---|
units |
The measurement unit for the voltage. |
Returns: The Motor’s maximum voltage in mV.
temperature()#
The temperature(units)
command gets the temperature of the Motor.
Parameters |
Description |
---|---|
units |
Optional. A valid TemperatureUnit. The default is |
Returns: A double that represents the temperature of the Motor in the units defined in the parameter.
get_motor_type()#
The get_motor_type()
command gets the type of the Motor, 11W, 5.5W, or MC55.
Returns: An integer that returns the type of the Motor, 0 is 11W, 1 is 5.5W, 2 is MC55.