gb.buttons.pressed

Description

bool gb.buttons.pressed( Button button )

gb.buttons.pressed returns true once you pressed down that button. It will not return true until the button is released and then pressed again.

Parameters

  • Button button: the button to check

Returns

bool: true if the button was pressed down just now

Example

#include <Gamebuino-Meta.h>

void setup() {
gb.begin();
}

void loop() {
while(!gb.update());
// check if A was pressed
if (gb.buttons.pressed(BUTTON_A)) {
// do something
}
}