Botón#

Dependiendo de si se trata de un controlador EXP o un controlador V5 conectado, el atributo button tiene acceso a diferentes objetos:

Controlador EXP

Controlador V5

<ul><li>`ButtonA` - El botón A.</li><li>`ButtonB` - El botón B.</li><li>`ButtonDown` - El botón Abajo.</li><li>`ButtonUp` - El botón Arriba.</li><li>`ButtonL1` - El botón L1.</li><li>`ButtonL2` - El botón L2.</li><li>`ButtonL3` - El botón L3.</li><li>`ButtonR1` - El botón R1.</li><li>`ButtonR2` - El botón R2.</li><li>`ButtonR3` - El botón R3.

<ul><li>`ButtonA` - El botón A.</li><li>`ButtonB` - El botón B.</li><li>`ButtonX` - El botón X.</li><li>`ButtonY` - El botón Y.</li><li>`ButtonDown` - El botón Abajo.</li><li>`ButtonUp` - El botón Arriba.</li><li>`ButtonLeft` - El botón Izquierdo.</li><li>`ButtonRight` - El botón Derecho.</li><li>`ButtonL1` - El botón L1.</li><li>`ButtonL2` - El botón L2.</li><li>`ButtonR1` - El botón R1.</li><li>`ButtonR2` - El botón R2.</li>

apretado()#

El método pressed(callback) registra una función que se llamará cuando se presione un botón.

Parámetro

Descripción

llamar de vuelta

Una función que se llamará cuando se presione el botón.

Devoluciones: Ninguna.

// 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()#

El método released(callback) registra una función que se llamará cuando se suelte un botón.

Parámetro

Descripción

llamar de vuelta

Una función que se llamará cuando se suelte el botón.

Devoluciones: Ninguna.

// 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()#

El método pressing() devuelve si un botón está siendo presionado actualmente.

Devuelve: true si el botón está siendo presionado actualmente. false si no está siendo presionado actualmente.