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

Use this class when programming with a motor connected to a victor motor controller. More...

#include <vex_triport.h>

Inheritance diagram for vex::motor_victor:
vex::__tridevice

Public Member Functions

 motor_victor (triport::port &port)
 Creates a new motor victor object on the port specified in the parameter. More...
 
 motor_victor (triport::port &port, bool reverse)
 Creates a new motor victor object on the port specified in the parameter. 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 setReversed (bool value)
 Sets the motor mode to "reverse", which will make motor commands spin the motor in the opposite direction. 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 stop (void)
 Stops the motor using the default brake mode. More...
 

Detailed Description

Use this class when programming with a motor connected to a victor motor controller.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ motor_victor() [1/2]

vex::motor_victor::motor_victor ( triport::port port)

Creates a new motor victor object on the port specified in the parameter.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::motor_victor Motor_victor = vex::motor_victor(Brain.ThreeWirePort.A);}

Parameters
portA reference to a three wire port.

◆ motor_victor() [2/2]

vex::motor_victor::motor_victor ( triport::port port,
bool  reverse 
)

Creates a new motor victor object on the port specified in the parameter.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::motor_victor Motor_victor = vex::motor_victor(Brain.ThreeWirePort.A);}

Parameters
portA reference to a three wire port.
reverseSets the reverse flag for the new motor_victor object.

Member Function Documentation

◆ setReversed()

void vex::motor_victor::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_victor.setReversed(true);}

Parameters
valueIf set to true, the motor will spin in the reversed direction.

◆ setVelocity()

void vex::motor_victor::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.

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

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

◆ spin() [1/2]

void vex::motor_victor::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_victor.spin(forward);} @cpp_sig{Motor_victor.spin(vex::directionType::fwd);}

Parameters
dirThe direction to spin the motor.

◆ spin() [2/2]

void vex::motor_victor::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_victor.spin(vex::directionType::fwd,50,vex::velocityUnits::rpm);}

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

◆ stop()

void vex::motor_victor::stop ( void  )

Stops the motor using the default brake mode.

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


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