Botón#

El cerebro EXP tiene acceso a tres objetos para sus tres botones:

  • buttonCheck

  • buttonLeft

  • buttonRight

apretado()#

The pressed(callback) method registers a function to be called when a button is pressed.

Parámetros

Descripción

llamar de vuelta

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

Devoluciones: Ninguna.

// Create a new function buttonPressed().
void button_pressed() {
  Brain.Screen.print("button pressed");
}

int main() {
  // When the Brain's Left button is pressed, run the
  // button_pressed function.
  Brain.buttonLeft.pressed(buttonPressed);
}

liberado()#

The released(callback) method registers a function to be called when a button is released.

Parámetros

Descripción

llamar de vuelta

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

Devoluciones: Ninguna.

// Create a new function buttonReleased().
void button_pressed() {
  Brain.Screen.print("button released");
}

int main() {
  // When the Brain's Left button is released, run the
  // button_pressed function.
  Brain.buttonLeft.released(buttonReleased);
}

prensado()#

The pressing() method returns whether a button is currently being pressed.

Returns: true if the button is being pressed. false if it is not.