Can someone help me solve this motor control issue

Hello Everyone,

Here I am again asking for help with this code, however I have narrowed down the issue to basically the Arduino Mega not being able to multi task. The basic thing that I'm asking in the code is for the arduino to just read the mouse data, not to use it or display it to me in any way. While spinning the motors continuously. The issue is that, when doing this I end up with only one motor receiving power to spin while the other doesn't. Maybe I have done something wrong, maybe theirs and issue with the arduino (I tested this on two other ones, with the same problem though) or maybe theirs an issue with the motor controller shield (however this seems to spin the motors fine when its told to just spin them by itself) or maybe its something else. If anyone has any suggestions on how to go about this, I would be very thankful!

My code:

#include "DualVNH5019MotorShield.h"
#include <ps2.h>

PS2 mouse(6, 5);
DualVNH5019MotorShield md;

char mstat;
char mx;
char my;

void setup() {
// put your setup code here, to run once:

Serial.begin(9600);md.init();

}

void loop() {
// put your main code here, to run repeatedly:

mouse.write(0xeb); // give me data!
mouse.read(); // ignore ack
mstat = mouse.read();
mx = mouse.read();
my = mouse.read();

md.setSpeeds(400, 400);
}