Botón#
Los botones disponibles en un controlador V5 son los siguientes:
Controlador V5 |
---|
|
apretado()#
The pressed(callback)
method registers a function to be called when a button is pressed.
Parámetro |
Descripción |
---|---|
llamar de vuelta |
Una función que se llamará cuando se presione el botón. |
Devuelve: Una instancia de la clase Event.
// Define the buttonPressed function with a void return
// type, showing it doesn't return a value.
void buttonPressed() {
// The Brain will print that a controller button was
// pressed on the Brain's screen.
Brain.Screen.print("controller button pressed");
}
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// Run buttonPressed when the 'A' controller button is pressed.
Controller.ButtonA.pressed(buttonPressed);
}
liberado()#
The released(callback, arg)
method registers a function to be called when a button is released.
Parámetro |
Descripción |
---|---|
llamar de vuelta |
Una función que se llamará cuando se suelte el botón. |
arg |
Opcional. Un parámetro para pasar a la función de devolución de llamada. |
Devuelve: Una instancia de la clase Event.
// Define the buttonReleased function with a void return
// type, showing it doesn't return a value.
void buttonReleased() {
// The Brain will print that a controller button was
// released on the Brain's screen.
Brain.Screen.print("controller button released");
}
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// Run buttonReleased when the 'A' controller button is released.
Controller.ButtonA.released(buttonReleased);
}
prensado()#
The pressing()
method returns whether a button is currently being pressed.
Devuelve: Verdadero si el botón está presionado. Falso si no está presionado.