controller#
For controller commands to appear in VEXcode, a V5 Controller must first be connected to VEXcode V5.
Refer to these articles for more information:
Initializing the Controller Class#
To use a Controller in your project, start by initializing it as follows:
# 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:
Class Methods#
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.
Parameter |
Description |
---|---|
pattern |
A pattern using ‘.’ and ‘-’ for short and long rumbles. |
Returns: None.
controller Controller1 = controller(primary);
// Rumble the Controller to the pattern short-short-long-long.
Controller.rumble('..--');