Hello All,
I hope this is the right place for my issues. This is my first project with Arduinos so I am woefully inexperienced with it.
Hardware: Arduino Leonardo
Code: (from this forum post: Debouncing dance pad keyboard input device - Programming Questions - Arduino Forum) Loaded with IDE v1.8.13
#include "Button.h"
#include <Keyboard.h>
Button buttons[4] = { 4, 5, 6, 7 };
const char keys[4] = { 'i', 'j', 'k', 'l' };
void setup() {
Keyboard.begin();
}
void loop() {
for (uint8_t i = 0; i < 4; i++) {
Button::State state = buttons[i].getState();
if (state == Button::Falling)
Keyboard.press(keys[i]);
else if (state == Button::Rising)
Keyboard.release(keys[i]);
}
}
Schematics:
The pads have aluminum foil on the bottom side to bridge the comb-shaped contacts when i step on the pad, sending keystrokes for the duration that I step on it. A side of each of the four pads is hooked up to their own pin, and the other sides are connected together to ground.
The Problem:
Whenever there are a lot of inputs in quick succession such as in the attached image of the audio-sync level for the game,
The arduino seems to lock up and not take any inputs. I noted that during normal operation, the TX LED lights up whenever I step on a pad and turns off when I lift my feet, but when it locks up, the TX LED is stuck on. Even unplugging the wires does not turn it off so I think there is something wrong with the board itself. I have tried different cables and different computers, yet the problem persists.
Any help would be greatly appreciated and I can provide more information if needed.



