motor_victor#
Inicializando la clase motor_victor#
Un controlador Motor Victor se crea utilizando uno de los siguientes constructores:
The motor_victor
constructor creates a motor_victor object in the specified Three Wire Port.
Parámetro |
Descripción |
---|---|
|
El puerto de 3 cables al que está conectado el controlador Motor Victor, ya sea un puerto en el Cerebro o un Expandedor de 3 cables. |
// Create the Brain.
brain Brain;
// Construct a Motor Victor Controller "victor" with the
// MotorVictor class.
motor_victor victor = motor_victor(Brain.ThreeWirePort.A);
The motor_victor(port, reverse)
constructor creates a motor_victor object in the specified Three Wire Port with the reverse flag set to the specified value.
Parámetro |
Descripción |
---|---|
|
El puerto de 3 cables al que está conectado el controlador Motor Victor, ya sea un puerto en el Cerebro o un Expandedor de 3 cables. |
|
Set this Motor to be reversed or not. If set to |
// Create the Brain.
brain Brain;
// Construct a Motor Victor Controller "victor" with the
// motor_victor class.
motor_victor victor = motor_victor(Brain.ThreeWirePort.A, true);
Primero se debe crear un Brain o un 3-Wire Expander antes de poder usarlos para crear un objeto con el constructor de clase motor_victor.
This victor
object will be used in all subsequent examples throughout this API documentation when referring to MotorVictor class methods.
Métodos de clase#
spin()#
Este es un método sin espera y permite que el siguiente método se ejecute sin demora.
Este método se llama de las siguientes maneras:
The spin(direction)
method spins the Motor in a specified direction at the default velocity. The Motor is assumed to have a maximum velocity of 100 rpm.
Parámetros |
Descripción |
---|---|
dirección |
Un directionType válido. |
Devoluciones: Ninguna.
// Spin the Motor forward.
victor.spin(forward);
The spin(direction, velocty, units)
method spins the Motor in a specified direction. The Motor is assumed to have a maximum velocity of 100 rpm.
Parámetros |
Descripción |
---|---|
dirección |
Un directionType válido. |
velocidad |
La velocidad para girar el motor. |
unidades |
Una velocityUnit válida. |
Devoluciones: Ninguna.
// Spin the Motor forward at 100 rpm.
victor.spin(forward, 100, rpm);
stop()#
The stop()
method stops the Motor.
Devoluciones: Ninguna.
setVelocity()#
The setVelocity()
method sets the velocity of the Motor. This will be the velocity used for subsequent calls of spin()
if a velocity is not provided.
Parámetros |
Descripción |
---|---|
valor |
El valor de velocidad a establecer. |
unidades |
The only valid unit for velocity in this usecase is |
Devoluciones: Ninguna.
setReversed()#
The setReversed(value)
method sets the Motor direction to be reversed or not.
Parámetros |
Descripción |
---|---|
valor |
A boolean or binary value to set the reverse flag of the motor to |
Devoluciones: Ninguna.