A-Maze a game of random generated mazes

Once again I have ported one of Alojz Jakob’s (the guy behind Tamaguino) games to the Arduboy and am grateful that he has included it as part of his main repo.
A-Maze-Arduboy.hex (68.8 KB)

The game features a series of random generated mazes and four game modes

Ino & Repo

Original Arduino Project page

Instructable Page


You could consider adding a delay after the first press of a button before it starts auto repeating (like PC keyboards do). This way you can be as precise as you want with single presses and as fast as you want once repeating starts.

You can look at the SetSystemEEPROM and RGBled example sketches in the Arduboy2 library for an example of doing this.


This week I wrote some prototyping button debounce and repeat code for my custom bootloader. Maybe it can be of help.

#include <Arduboy2.h>

Arduboy2  arduboy;
uint8_t ButtonsDebounceState;
uint8_t buttonsDebounceDelay;
uint8_t buttonsRepeatDelay;
uint8_t oldButtonsState;
uint8_t ButtonsState;

bool red_on, blue_on;

#define BUTTON_DEBOUNCE_DELAY 10  //time for button states to stabelize
#define BUTTON_REPEAT_DELAY   250 //time before buttons start to repeat
#define BUTTON_REPEAT_SPEED   125 //button repeat interval

void setup()

void loop() 
 arduboy.delayShort(1); //using 1 msec per loop timing interval
 uint8_t currentButtonsState = arduboy.buttonsState();
 if (currentButtonsState == ButtonsDebounceState)
  if (buttonsDebounceDelay > 0) //still in debounce timeout period
  else //// debounce timeout expired, buttons state is stable ////
    if (currentButtonsState == oldButtonsState) //no changes, check autorepeat
      if (buttonsRepeatDelay > 0) //still in repeat timeout period
        ButtonsState = 0;
      else //repeat timeout expired, repeat button
        ButtonsState = oldButtonsState;
        buttonsRepeatDelay = BUTTON_REPEAT_SPEED;
    else //pressed buttons changed
      ButtonsState = (~oldButtonsState) & currentButtonsState;
      oldButtonsState = currentButtonsState;
      buttonsRepeatDelay = BUTTON_REPEAT_DELAY;
  } //////////////////////////////////////////////////////////  
 else //still bouncing
  ButtonsDebounceState  = currentButtonsState;
  buttonsDebounceDelay = BUTTON_DEBOUNCE_DELAY;
 //some test code, toggle LED states
 if (ButtonsState & A_BUTTON) red_on = !red_on;
 if (ButtonsState  & B_BUTTON) blue_on = !blue_on;
 //control LEDs
 if (red_on) arduboy.digitalWriteRGB(RED_LED, RGB_ON); else arduboy.digitalWriteRGB(RED_LED, RGB_OFF);
 if (blue_on) arduboy.digitalWriteRGB(BLUE_LED, RGB_ON); else arduboy.digitalWriteRGB(BLUE_LED, RGB_OFF);

I forgot to update this but there are now four game modes and battery monitor. the battery monitor works but could do with some improvements
you can grab the latest here:

video of new modes

i’ll update first post one pull request done.


Where is the code for displayBattery?

In the main .ino readVcc() it could be improved a lot even though I got it close to my multimeter with the -249

Hey @Keyboard_Camper I just checked but I didn’t see a hex file in there, is there one available?

1 Like

kinda late but updated first post :slight_smile:


I’ve only just got round to actually playing this.
I think the direction buttons are a little over sensitive, but a neat port nonetheless.

This is slick. Agree on the button repeat speed, pretty fast.

1 Like