gb.buttons.timeHeld

Description

uint16_t gb.buttons.timeHeld( Button button )

gb.buttons.timeHeld returns the number of frames a button has been held down already, or 0xFFFF if the button has just been released.

Parameters

  • Button button: the button to check

Returns

uint16_t: number of frames the button has been held down

Example

#include <Gamebuino-Meta.h>

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

void loop() {
while(!gb.update());
gb.display.clear();

// fetch how long the A button has been held down
uint16_t time = gb.buttons.timeHeld(BUTTON_A);
gb.display.println(time);
}