justPressed() issue

I’m trying to develop a small game and recently changed over to the arduboy2 library (since this freed some memory).
However I’m having trouble getting justPressed() to work.

To make sure its not a issue with my game, I loaded the arduboy’s ‘buttons’ example. The only lines I changed are the include (arduboy -> arduboy2), the initialisation (Arduboy2 arduboy) and the right pressed code to use justPressed():

if(arduboy.justPressed(RIGHT_BUTTON) && (x < X_MAX)) {

Unfortunately with this all the buttons still work except for the RIGHT_BUTTON which does nothing.

Am I missing something simple, or is there an issue with the library?

justPressed() relies on the pollButtons() function. pollButtons() should be called at the start of each frame.

void loop() {
  // pause render until it's time for the next frame
  if (!(arduboy.nextFrame()))


Awesome - in all my searching I managed to completely miss that thread!
Thanks :slight_smile:

1 Like