controlador#

Para que los comandos del controlador aparezcan en VEXcode, primero se debe conectar un controlador V5 a VEXcode V5.

Consulte estos artículos para obtener más información:

Inicialización de la clase controlador#

Para utilizar un controlador en su proyecto, comience inicializándolo de la siguiente manera:

# Create a new object "Controller" with the Controller class.
controller Controller = controller();

This Controller object will be used in all subsequent examples throughout this API documentation when referring to Controller class methods and attributes.

The Controller class comes with three pre-defined attributes, though the screen attribute is only available if you are using a V5 Controller:

  • Axis - Allows you to detect movements in the Controller’s joysticks and assign functions to axes events.

  • Button - Allows you to detect button presses and assign functions to button events on the Controller.

  • Screen - Enables you to display text and draw images on the V5 Controller’s screen.

Atributos

Métodos de clase#

In addition to its attributes, the Controller has access to the rumble method.

rumble()#

The rumble(pattern) command rumbles the controller by a pattern defined by the parameter, pattern. Dots equal short rumbles, dashes equal long rumbles, and space equals a pause.

Parámetro

Descripción

pattern

Un patrón que utiliza ‘.’ y ‘-’ para ruidos cortos y largos.

Devoluciones: Ninguna.

controller Controller1 = controller(primary);

// Rumble the Controller to the pattern short-short-long-long.
Controller.rumble('..--');