Arduino Micro Keyboard Control to MAME - Guidance

I am wanting to use the Arduino Micro to interface between buttons and keyboard button presses to allow a mame game being played with buttons.
I have used the below code. The code functions perfectly when the buttons press letters in a test in notepad and when testing with the below mapping on notepad (just cant check alt and ctr to accurately), but once i actually start the emulator the actions are only preformed after, what seems, a random amount of clicking the buttons and then not even with a perceived sense of rhythm. I am not sure what section this question would go under but i am just wanting to know whether i missed something obvious or whether it is just a compatibility issue with the emulator.
I am able to see the micro's tx led blinking when ever i press a button.

// set pin numbers for the buttons:
const int rightButton = 4;     
const int downButton = 5;        
const int upButton  = 6;
const int leftButton  = 7;
const int shoot = 8;
const int jump = 9;
const int nade = 10;
const byte SC_SPACE = 0x20;

void setup() { // initialize the buttons' inputs:
  pinMode(upButton, INPUT);           // set pin to input
  digitalWrite(upButton, HIGH);       // turn on pullup resistors
  pinMode(downButton, INPUT);           // set pin to input
  digitalWrite(downButton, HIGH);       // turn on pullup resistors
  pinMode(leftButton, INPUT);           // set pin to input
  digitalWrite(leftButton, HIGH);       // turn on pullup resistors
  pinMode(rightButton, INPUT);           // set pin to input
  digitalWrite(rightButton, HIGH);       // turn on pullup resistors
  pinMode(shoot, INPUT);           // set pin to input
  digitalWrite(shoot, HIGH);       // turn on pullup resistors
  pinMode(jump, INPUT);           // set pin to input
  digitalWrite(jump, HIGH);       // turn on pullup resistors
  pinMode(nade, INPUT);           // set pin to input
  digitalWrite(nade, HIGH);       // turn on pullup resistors

void loop() {
  // use the pushbuttons to control the keyboard:
  if (digitalRead(upButton) == LOW) {;
  if (digitalRead(downButton) == LOW) {
  if (digitalRead(leftButton) == LOW) {
  if (digitalRead(rightButton) == LOW) {
  if (digitalRead(shoot) == LOW) {
  if (digitalRead(jump) == LOW) {
  if (digitalRead(nade) == LOW) {
  delay(100);  // wait for 100 milliseconds to slow it down   

would i need to take out the delay and make the buttons be state-full and use .press until state changes then release?

I was going to try your code with my Uno, but it says ""'Keyboard' only supported on the Arduino Leonardo." Bummer...

ANYWAY... I'm responding to this post because if you're trying to use this for MAME, I would suggest going an entirely different route altogether. Check this link: The project is using the Minimus USB Dev board, which will run you around $10. If you go through the Kade website, you will find a loader that they have even created for it (with the option for a custom key layout).


I'd tried that in the meantime. If you get this code working for the Uno, I would DEFINITELY be interested in it as an alternative. Sorry I can't be of more help.