motor29#

Inicializando la clase motor29#

Un controlador de motor 29, que se utiliza para controlar un motor 393, se crea utilizando uno de los siguientes constructores.

The motor29(port) constructor creates a motor29 object in the specified Three Wire Port.

Parámetro

Descripción

port

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.

The motor29(port, reverse) constructor creates a motor29 object in the specified Three Wire Port with the reverse flag set to the specified value.

Parámetro

Descripción

port

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.

reverse

Set this Motor to be reversed or not. If set to true, the Motor will spin in the opposite rotation. The default is false.

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.
motor29 mc29 = motor29(Brain.ThreeWirePort.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()#

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(dir) 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

director

Un directionType válido.

// spin motor forward.
mc29.spin(forward);

The spin(direction, velocity, units) method spins the motor in a specified direction at the specified velocity. 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.

// spin motor forward at 100 rpm.
mc29.spin(forward, 100, rpm);

Devoluciones: Ninguna.

stop()#

The stop() method stops the motor.

Devoluciones: Ninguna.

setVelocity()#

The setVelocity(velocity, units) 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.

Este es un método sin espera y permite que el siguiente método se ejecute sin demora.

Parámetros

Descripción

velocidad

El valor de velocidad a establecer.

unidades

The only valid unit for velocity in this usecase is percent.

Devoluciones: Ninguna.

setReversed()#

The setReversed() method sets the motor direction to be reversed or not.

Parámetros

Descripción

valor

Un valor booleano o binario para establecer si la dirección se invierte o no.

Devoluciones: Ninguna.