VEXcode Doxygen
Public Member Functions | Protected Member Functions | List of all members
vex::motor Class Reference

Use the motor class to control motor devices. More...

#include <vex_motor.h>

Inheritance diagram for vex::motor:
vex::device

Public Member Functions

 motor (int32_t index)
 Creates a new motor object on the port specified. More...
 
bool installed ()
 
int32_t value ()
 
 motor (int32_t index, bool reverse)
 Creates a new motor object on the port specified and sets the reversed flag. More...
 
 motor (int32_t index, gearSetting gears)
 Creates a new motor object on the port specified and sets the gear setting. More...
 
 motor (int32_t index, gearSetting gears, bool reverse)
 Creates a new motor object on the port specified Sets the reversed flag and the gear setting for the new motor object. More...
 
void setReversed (bool value)
 Sets the motor mode to "reverse", which will make motor commands spin the motor in the opposite direction. More...
 
void setVelocity (double velocity, velocityUnits units)
 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. More...
 
void setVelocity (double velocity, percentUnits units)
 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. More...
 
void setBrake (brakeType mode)
 
void setStopping (brakeType mode)
 Sets the stopping mode of the motor by passing a brake mode as a parameter. More...
 
void resetRotation (void)
 Resets the motor's encoder to the value of zero. More...
 
void resetPosition (void)
 Resets the motor's encoder to the value of zero. More...
 
void setRotation (double value, rotationUnits units)
 Sets the value of the motor's encoder to the value specified in the parameter. More...
 
void setPosition (double value, rotationUnits units)
 Sets the value of the motor's encoder to the value specified in the parameter. More...
 
void setTimeout (int32_t time, timeUnits units)
 Sets the timeout for the motor. If the motor does not reach its' commanded position prior to the completion of the timeout, the motor will stop. More...
 
void spin (directionType dir)
 Turns the motor on, and spins it in the specified direction. More...
 
void spin (directionType dir, double velocity, velocityUnits units)
 Turns on the motor and spins it in a specified direction and a specified velocity. More...
 
void spin (directionType dir, double velocity, percentUnits units)
 
void spin (directionType dir, double voltage, voltageUnits units)
 Turns on the motor and spins it in a specified direction and a specified voltage. More...
 
bool rotateTo (double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 Turns on the motor and spins it to an absolute target rotation value at a specified velocity. More...
 
bool spinTo (double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 
bool spinToPosition (double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 
bool rotateTo (double rotation, rotationUnits units, bool waitForCompletion=true)
 Turns on the motor and spins it to an absolute target rotation value. More...
 
bool spinTo (double rotation, rotationUnits units, bool waitForCompletion=true)
 
bool spinToPosition (double rotation, rotationUnits units, bool waitForCompletion=true)
 
bool rotateFor (double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 Turns on the motor and spins it to a relative target rotation value at a specified velocity. More...
 
bool spinFor (double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 
bool rotateFor (directionType dir, double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 
bool spinFor (directionType dir, double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 
bool rotateFor (double rotation, rotationUnits units, bool waitForCompletion=true)
 Turns on the motor and spins it to a relative target rotation value. More...
 
bool spinFor (double rotation, rotationUnits units, bool waitForCompletion=true)
 
bool rotateFor (directionType dir, double rotation, rotationUnits units, bool waitForCompletion=true)
 
bool spinFor (directionType dir, double rotation, rotationUnits units, bool waitForCompletion=true)
 
bool rotateFor (double time, timeUnits units, double velocity, velocityUnits units_v)
 Turns on the motor and spins it to a relative target time value at a specified velocity. More...
 
bool spinFor (double time, timeUnits units, double velocity, velocityUnits units_v)
 
bool rotateFor (directionType dir, double time, timeUnits units, double velocity, velocityUnits units_v)
 
bool spinFor (directionType dir, double time, timeUnits units, double velocity, velocityUnits units_v)
 
bool rotateFor (double time, timeUnits units)
 Turns on the motor and spins it to a relative target time value. More...
 
bool spinFor (double time, timeUnits units)
 
bool rotateFor (directionType dir, double time, timeUnits units)
 
bool spinFor (directionType dir, double time, timeUnits units)
 
void startRotateTo (double rotation, rotationUnits units, double velocity, velocityUnits units_v)
 Starts spinning a motor to an absolute target rotation but does not wait for the motor to reach that target. More...
 
void startSpinTo (double rotation, rotationUnits units, double velocity, velocityUnits units_v)
 
void startRotateTo (double rotation, rotationUnits units)
 Starts spinning a motor to an absolute target rotation but does not wait for the motor to reach that target. More...
 
void startSpinTo (double rotation, rotationUnits units)
 
void startRotateFor (double rotation, rotationUnits units, double velocity, velocityUnits units_v)
 Starts spinning a motor to a relative target rotation but does not wait for the motor to reach that target. More...
 
void startSpinFor (double rotation, rotationUnits units, double velocity, velocityUnits units_v)
 
void startRotateFor (directionType dir, double rotation, rotationUnits units, double velocity, velocityUnits units_v)
 
void startSpinFor (directionType dir, double rotation, rotationUnits units, double velocity, velocityUnits units_v)
 
void startRotateFor (double rotation, rotationUnits units)
 Starts spinning a motor to a relative target but does not wait for the motor to reach that target. More...
 
void startSpinFor (double rotation, rotationUnits units)
 
void startRotateFor (directionType dir, double rotation, rotationUnits units)
 
void startSpinFor (directionType dir, double rotation, rotationUnits units)
 
bool isSpinning (void)
 Checks to see if the motor is rotating to a specific target. More...
 
bool isDone (void)
 Checks to see if the motor is done rotating to a specific target. More...
 
void stop (void)
 Stops the motor using the default brake mode. More...
 
void stop (brakeType mode)
 Stops the motor using a specified brake mode. More...
 
void setMaxTorque (double value, percentUnits units)
 Sets the max torque of the motor. More...
 
void setMaxTorque (double value, torqueUnits units)
 Sets the max torque of the motor. More...
 
void setMaxTorque (double value, currentUnits units)
 Sets the max torque of the motor. More...
 
directionType direction (void)
 Gets which direction the motor is spinning. More...
 
double rotation (rotationUnits units)
 Gets the current rotation of the motor's encoder. More...
 
double position (rotationUnits units)
 Gets the current position of the motor's encoder. More...
 
double velocity (velocityUnits units)
 Gets the current velocity of the motor. More...
 
double velocity (percentUnits units)
 
double current (currentUnits units=currentUnits::amp)
 Gets the electrical current of the motor. More...
 
double current (percentUnits units)
 Gets the electrical current of the motor in percentage of maximum. More...
 
double power (powerUnits units=powerUnits::watt)
 Gets the power of the motor. More...
 
double torque (torqueUnits units=torqueUnits::Nm)
 Gets the torque of the motor. More...
 
double efficiency (percentUnits units=percentUnits::pct)
 Gets the efficiency of the motor. More...
 
double temperature (percentUnits units=percentUnits::pct)
 Gets the temperature of the motor. More...
 
double temperature (temperatureUnits units)
 Gets the temperature of the motor. More...
 
- Public Member Functions inherited from vex::device
 device (int32_t index)
 
V5_DeviceType type ()
 
int32_t index ()
 
void init (int32_t index)
 

Protected Member Functions

int32_t getTimeout ()
 

Additional Inherited Members

- Protected Attributes inherited from vex::device
int32_t _index
 
int32_t _threadID
 

Detailed Description

Use the motor class to control motor devices.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ motor() [1/4]

vex::motor::motor ( int32_t  index)

Creates a new motor object on the port specified.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::motor Motor = vex::motor(vex::PORT1);}

Parameters
indexThe port index for this motor. The index is zero-based.

◆ motor() [2/4]

vex::motor::motor ( int32_t  index,
bool  reverse 
)

Creates a new motor object on the port specified and sets the reversed flag.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::motor Motor = vex::motor(vex::PORT1, false);}

Parameters
indexThe port index for this motor. The index is zero-based.
reverseSets the reverse flag for the new motor object.

◆ motor() [3/4]

vex::motor::motor ( int32_t  index,
gearSetting  gears 
)

Creates a new motor object on the port specified and sets the gear setting.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::motor Motor = vex::motor(vex::PORT1, vex::gearSetting::ratio18_1);}

Parameters
indexThe port index for this motor. The index is zero-based.
gearsSets the gear's setting for the new motor object.

◆ motor() [4/4]

vex::motor::motor ( int32_t  index,
gearSetting  gears,
bool  reverse 
)

Creates a new motor object on the port specified Sets the reversed flag and the gear setting for the new motor object.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::motor Motor = vex::motor(vex::PORT1, vex::gearSetting::ratio18_1, false);}

Parameters
indexThe port index for this motor. The index is zero-based.
gearsSets the gear's setting for the new motor object.
reverseSets the reverse flag for the new motor object.

Member Function Documentation

◆ current() [1/2]

double vex::motor::current ( currentUnits  units = currentUnits::amp)

Gets the electrical current of the motor.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.current(amp)} @cpp_sig{Motor.current(vex::currentUnits::amp)}

Returns
Returns a double that represents the electrical current of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the current.

◆ current() [2/2]

double vex::motor::current ( percentUnits  units)

Gets the electrical current of the motor in percentage of maximum.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.current(percent)} @cpp_sig{Motor.current(vex::percentUnits::pct)}

Returns
Returns a double that represents the electrical current of the motor as percentage of max current.
Parameters
unitsThe measurement unit for the current.

◆ direction()

directionType vex::motor::direction ( void  )

Gets which direction the motor is spinning.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.direction()}

Returns
Returns the direction that the motor is spinning.

◆ efficiency()

double vex::motor::efficiency ( percentUnits  units = percentUnits::pct)

Gets the efficiency of the motor.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.efficiency(percent)} @cpp_sig{Motor.efficiency(vex::percentUnits::pct)}

Returns
Returns the efficiency of the motor in the units defined in the parameter.
Parameters
units(Optional) The measurement unit for the efficiency. By default, this parameter is a percentage.

◆ isDone()

bool vex::motor::isDone ( void  )

Checks to see if the motor is done rotating to a specific target.

@prog_lang{block} @drawer_cat{sensing} @block_sig{Motor.isDone()}

Returns
Returns a false Boolean if the motor is on and is rotating to a target. Returns a true Boolean if the motor is done rotating to a target.

◆ isSpinning()

bool vex::motor::isSpinning ( void  )

Checks to see if the motor is rotating to a specific target.

@prog_lang{cpp|pro|block} @drawer_cat{sensing} @block_sig{Motor.isSpinning()}

Returns
Returns a true Boolean if the motor is on and is rotating to a target. Returns a false Boolean if the motor is done rotating to a target.

◆ position()

double vex::motor::position ( rotationUnits  units)

Gets the current position of the motor's encoder.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.position(degrees)} @cpp_sig{Motor.position(vex::rotationUnits::deg)}

Returns
Returns a double that represents the current position of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the position.

◆ power()

double vex::motor::power ( powerUnits  units = powerUnits::watt)

Gets the power of the motor.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.power(watt);} @cpp_sig{Motor.power(vex::powerUnits::watt)}

Returns
Returns a double that represents the power of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the power.

◆ resetPosition()

void vex::motor::resetPosition ( void  )

Resets the motor's encoder to the value of zero.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Motor.resetPosition();}

◆ resetRotation()

void vex::motor::resetRotation ( void  )

Resets the motor's encoder to the value of zero.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Motor.resetRotation();}

◆ rotateFor() [1/4]

bool vex::motor::rotateFor ( double  rotation,
rotationUnits  units,
bool  waitForCompletion = true 
)

Turns on the motor and spins it to a relative target rotation value.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Motor.rotateFor(90, degrees);} @cpp_sig{Motor.rotateFor(90,vex::rotationUnits::deg);}

Returns
Returns a Boolean that signifies when the motor has reached the target rotation value. @parameter_number_override{2} @return_type_override{void}
Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
waitForCompletion(Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true.

◆ rotateFor() [2/4]

bool vex::motor::rotateFor ( double  rotation,
rotationUnits  units,
double  velocity,
velocityUnits  units_v,
bool  waitForCompletion = true 
)

Turns on the motor and spins it to a relative target rotation value at a specified velocity.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Motor.rotateFor(90,vex::rotationUnits::deg,50,vex::velocityUnits::pct);}

Returns
Returns a Boolean that signifies when the motor has reached the target rotation value.
Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
velocitySets the amount of velocity.
units_vThe measurement unit for the velocity value.
waitForCompletion(Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true.

◆ rotateFor() [3/4]

bool vex::motor::rotateFor ( double  time,
timeUnits  units 
)

Turns on the motor and spins it to a relative target time value.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Motor.rotateFor(2.5, vex::timeUnits::sec);}

Returns
true on success, false if parameter error
Parameters
timeSets the amount of time.
unitsThe measurement unit for the time value.

◆ rotateFor() [4/4]

bool vex::motor::rotateFor ( double  time,
timeUnits  units,
double  velocity,
velocityUnits  units_v 
)

Turns on the motor and spins it to a relative target time value at a specified velocity.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Motor.rotateFor(2.5, vex::timeUnits::sec, 50, vex::velocityUnits::pct);}

Returns
true on success, false if parameter error
Parameters
timeSets the amount of time.
unitsThe measurement unit for the time value.
velocitySets the amount of velocity.
units_vThe measurement unit for the velocity value.

◆ rotateTo() [1/2]

bool vex::motor::rotateTo ( double  rotation,
rotationUnits  units,
bool  waitForCompletion = true 
)

Turns on the motor and spins it to an absolute target rotation value.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Motor.rotateTo(90, degrees);} @cpp_sig{Motor.rotateTo(90,vex::rotationUnits::deg);}

Returns
Returns a Boolean that signifies when the motor has reached the target rotation value. @parameter_number_override{2} @return_type_override{void}
Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
waitForCompletion(Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true.

◆ rotateTo() [2/2]

bool vex::motor::rotateTo ( double  rotation,
rotationUnits  units,
double  velocity,
velocityUnits  units_v,
bool  waitForCompletion = true 
)

Turns on the motor and spins it to an absolute target rotation value at a specified velocity.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Motor.rotateTo(90, vex::rotationUnits::deg, 50, vex::velocityUnits::pct);}

Returns
Returns a Boolean that signifies when the motor has reached the target rotation value.
Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
velocitySets the amount of velocity.
units_vThe measurement unit for the velocity value.
waitForCompletion(Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true.

◆ rotation()

double vex::motor::rotation ( rotationUnits  units)

Gets the current rotation of the motor's encoder.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.rotation(degrees)} @cpp_sig{Motor.rotation(vex::rotationUnits::deg)}

Returns
Returns a double that represents the current rotation of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the rotation.

◆ setMaxTorque() [1/3]

void vex::motor::setMaxTorque ( double  value,
currentUnits  units 
)

Sets the max torque of the motor.

@prog_lang{pro} @drawer_cat{setting} @block_sig{Motor.setMaxTorque(1.25,vex::currentUnits::amps);}

Parameters
valueSets the amount of torque.
unitsThe measurement unit for the torque value.

◆ setMaxTorque() [2/3]

void vex::motor::setMaxTorque ( double  value,
percentUnits  units 
)

Sets the max torque of the motor.

@prog_lang{block|cpp|pro} @drawer_cat{setting} @block_sig{Motor.setMaxTorque(50,percent);} @cpp_sig{Motor.setMaxTorque(50,vex::percentUnits::pct);}

Parameters
valueSets the amount of torque.
unitsThe measurement unit for the torque value.

◆ setMaxTorque() [3/3]

void vex::motor::setMaxTorque ( double  value,
torqueUnits  units 
)

Sets the max torque of the motor.

@prog_lang{pro} @drawer_cat{setting} @block_sig{Motor.setMaxTorque(1,vex::torqueUnits::Nm);}

Parameters
valueSets the amount of torque.
unitsThe measurement unit for the torque value.

◆ setPosition()

void vex::motor::setPosition ( double  value,
rotationUnits  units 
)

Sets the value of the motor's encoder to the value specified in the parameter.

@prog_lang{block|cpp|pro} @drawer_cat{setting} @block_sig{Motor.setPosition(90, degrees);} @cpp_sig{Motor.setPosition(90,vex::rotationUnits::deg);}

Parameters
valueSets the current position of the motor.
unitsThe measurement unit for the position value.

◆ setReversed()

void vex::motor::setReversed ( bool  value)

Sets the motor mode to "reverse", which will make motor commands spin the motor in the opposite direction.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Motor.setReversed(true);}

Parameters
valueIf set to true, motor commands spin the motor in the opposite direction.

◆ setRotation()

void vex::motor::setRotation ( double  value,
rotationUnits  units 
)

Sets the value of the motor's encoder to the value specified in the parameter.

@prog_lang{block|cpp|pro} @drawer_cat{setting} @block_sig{Motor.setRotation(90, degrees);} @cpp_sig{Motor.setRotation(90,vex::rotationUnits::deg);}

Parameters
valueSets the amount of rotation.
unitsThe measurement unit for the rotation value.

◆ setStopping()

void vex::motor::setStopping ( brakeType  mode)

Sets the stopping mode of the motor by passing a brake mode as a parameter.

@prog_lang{block|cpp|pro} @drawer_cat{setting} @block_sig{Motor.setStopping(coast);} @cpp_sig{Motor.setStopping(vex::brakeType::coast);}

Parameters
modeThe stopping mode can be set to coast, brake, or hold.

◆ setTimeout()

void vex::motor::setTimeout ( int32_t  time,
timeUnits  units 
)

Sets the timeout for the motor. If the motor does not reach its' commanded position prior to the completion of the timeout, the motor will stop.

@prog_lang{block|cpp|pro} @drawer_cat{setting} @block_sig{Motor.setTimeout(30, seconds);} @cpp_sig{Motor.setTimeout(30, vex::timeUnits::sec);}

Parameters
timeSets the amount of time.
unitsThe measurement unit for the time value.

◆ setVelocity() [1/2]

void vex::motor::setVelocity ( double  velocity,
percentUnits  units 
)
inline

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.

@prog_lang{block} @drawer_cat{setting} @block_sig{Motor.setVelocity(50, percent);}

Parameters
velocitySets the amount of velocity.
unitsThe measurement unit for the velocity value.

◆ setVelocity() [2/2]

void vex::motor::setVelocity ( double  velocity,
velocityUnits  units 
)

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.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Motor.setVelocity(50, vex::velocityUnits::rpm);}

Parameters
velocitySets the amount of velocity.
unitsThe measurement unit for the velocity value.

◆ spin() [1/3]

void vex::motor::spin ( directionType  dir)

Turns the motor on, and spins it in the specified direction.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Motor.spin(forward);} @cpp_sig{Motor.spin(vex::directionType::fwd);}

Parameters
dirThe direction to spin the motor.

◆ spin() [2/3]

void vex::motor::spin ( directionType  dir,
double  velocity,
velocityUnits  units 
)

Turns on the motor and spins it in a specified direction and a specified velocity.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Motor.spin(vex::directionType::fwd,50,vex::velocityUnits::rpm);}

Parameters
dirThe direction to spin the motor.
velocitySets the amount of velocity.
unitsThe measurement unit for the velocity value.

◆ spin() [3/3]

void vex::motor::spin ( directionType  dir,
double  voltage,
voltageUnits  units 
)

Turns on the motor and spins it in a specified direction and a specified voltage.

@prog_lang{pro} @drawer_cat{action} @block_sig{Motor.spin(vex::directionType::fwd,6,vex::voltageUnits::volt);}

Parameters
dirThe direction to spin the motor.
voltageSets the amount of volts.
unitsThe measurement unit for the voltage value.

◆ startRotateFor() [1/2]

void vex::motor::startRotateFor ( double  rotation,
rotationUnits  units 
)

Starts spinning a motor to a relative target but does not wait for the motor to reach that target.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Motor.startRotateFor(90,degrees);} @cpp_sig{Motor.startRotateFor(90,vex::rotationUnits::deg);}

Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.

◆ startRotateFor() [2/2]

void vex::motor::startRotateFor ( double  rotation,
rotationUnits  units,
double  velocity,
velocityUnits  units_v 
)

Starts spinning a motor to a relative target rotation but does not wait for the motor to reach that target.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Motor.startRotateFor(90,vex::rotationUnits::deg,50,vex::velocityUnits::pct);}

Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
velocitySets the amount of velocity.
units_vThe measurement unit for the velocity value.

◆ startRotateTo() [1/2]

void vex::motor::startRotateTo ( double  rotation,
rotationUnits  units 
)

Starts spinning a motor to an absolute target rotation but does not wait for the motor to reach that target.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Motor.startRotateTo(90,degrees);} @cpp_sig{Motor.startRotateTo(90,vex::rotationUnits::deg);}

Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.

◆ startRotateTo() [2/2]

void vex::motor::startRotateTo ( double  rotation,
rotationUnits  units,
double  velocity,
velocityUnits  units_v 
)

Starts spinning a motor to an absolute target rotation but does not wait for the motor to reach that target.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Motor.startRotateTo(90,vex::rotationUnits::deg,50,vex::velocityUnits::pct);}

Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
velocitySets the amount of velocity.
units_vThe measurement unit for the velocity value.

◆ stop() [1/2]

void vex::motor::stop ( brakeType  mode)

Stops the motor using a specified brake mode.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Motor.stop(vex::brakeType::coast);}

Parameters
modeThe brake mode can be set to coast, brake, or hold.

◆ stop() [2/2]

void vex::motor::stop ( void  )

Stops the motor using the default brake mode.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Motor.stop();}

◆ temperature() [1/2]

double vex::motor::temperature ( percentUnits  units = percentUnits::pct)

Gets the temperature of the motor.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.temperature(percent)} @cpp_sig{Motor.temperature(vex::percentUnits::pct)}

Returns
Returns the temperature of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the temperature.

◆ temperature() [2/2]

double vex::motor::temperature ( temperatureUnits  units)

Gets the temperature of the motor.

@prog_lang{cpp|pro} @drawer_cat{sensing} @block_sig{Motor.temperature(vex::temperatureUnits::celsius)}

Returns
Returns the temperature of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the temperature.

◆ torque()

double vex::motor::torque ( torqueUnits  units = torqueUnits::Nm)

Gets the torque of the motor.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.torque(newtonMeters)} @cpp_sig{Motor.torque(vex::torqueUnits::Nm)}

Returns
Returns a double that represents the torque of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the torque.

◆ velocity()

double vex::motor::velocity ( velocityUnits  units)

Gets the current velocity of the motor.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Motor.velocity(rpm)} @cpp_sig{Motor.velocity(vex::velocityUnits::pct)}

Returns
Returns a double that represents the current velocity of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the velocity.

The documentation for this class was generated from the following file: