Motor29#
Para que los comandos Motor29 aparezcan en VEXcode V5, se debe configurar un Controlador de motor 29 en la ventana Dispositivos.
Inicializando la clase Motor29#
Un controlador de motor 29, que se utiliza para controlar un motor 393, se crea utilizando el siguiente constructor:
Motor29(port, reverse)
Este constructor utiliza dos parámetros:
Parámetro |
Descripción |
---|---|
|
El puerto de 3 cables al que está conectado el controlador del motor 29, ya sea un puerto en el Cerebro o un Expandedor de 3 cables. |
|
Optional. Set this Motor to be reversed or not. If set to |
Primero se debe crear un Brain o un 3-Wire Expander antes de poder usarlos para crear un objeto con el constructor de clase Motor29.
# Create the Brain.
brain = Brain()
# Construct a Motor Controller 29 "mc29" with the Motor29 class.
mc29 = Motor29(brain.three_wire_port.a)
This mc29
object will be used in all subsequent examples throughout this API documentation when referring to Motor29 class methods.
Métodos de clase#
spin()#
The spin(direction, velocity, units)
method spins the Motor in a specified direction. The Motor is assumed to have a maximum velocity of 100 rpm.
Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.
Parámetros |
Descripción |
---|---|
dirección |
Un DirectionType válido. |
velocidad |
Optional. The velocity to spin the Motor. The default velocity is set by the |
unidades |
Optional. A valid VelocityUnits type. The default is |
Devoluciones: Ninguna.
# Spin the Motor forward at velocity set with set_velocity.
mc29.spin(FORWARD)
detener()#
The stop()
method stops the Motor.
Devoluciones: Ninguna.
establecer_velocidad()#
The set_velocity()
method sets the velocity of the Motor. This will be the velocity used for subsequent calls of the spin()
method that do not specify a velocity.
Parámetros |
Descripción |
---|---|
valor |
El valor de velocidad a establecer. |
unidades |
A valid VelocityUnits type. The default is |
Devoluciones: Ninguna.
set_reversed()#
The set_reversed()
method sets the Motor direction to be reversed or not.
Parámetros |
Descripción |
---|---|
valor |
|
Devoluciones: Ninguna.
# Reverse the Motor's direction.
mc29.set_reversed(True)