I'm new to Arduino so if this is a stupid topic, then there's my excuse. Anyways, I am using an Arduino Micro and the ArduinoXInput Library (Github: GitHub - dmadison/ArduinoXInput: XInput library for USB capable Arduino boards). I am trying to have two XInputs happen at the same time when one button is pressed. It works most of the time, but every once in a while they desync and they happen one after another.
Here's the code in the loop():
if (digitalRead(12) == HIGH) {
XInput.press(DPAD_UP);
XInput.press(DPAD_RIGHT);
}
else if (digitalRead(12) == LOW) {
XInput.release(DPAD_UP);
XInput.release(DPAD_RIGHT);
}
Here's a .gif showing what's happening:

I repeatedly press one button on pin 12 and occasionally only one of the XInputs happen instead of two. (in the example, only the up XInput happens instead of both up and right XInputs)