DF Robot Shop Motor Commands

I think I need some way to start the millis() counter once I send the "left" command over the serial port.

No. I can assure you that you do not need to restart the millis() counter. If you call your girlfriend (or boyfriend) and she/he says call me back in an hour, do you need to reset your watch? No, of course not. You simply note the current time. At many points in the future, you check the current time, and see if "now" minus "then" is greater to or equal to an hour. If so, you make the call again.

void left (char a,char b)
{
  int x = millis();
 
  while (x < 300)

{
  analogWrite (E1,a);
  digitalWrite(M1,LOW);
  analogWrite (E2,b);
  digitalWrite(M2,HIGH);
}

}

First off, millis() does not return an int. It returns an unsigned long. After the Arduino has been running for 32.7+ seconds, the output from millis() will overflow an int.

Something like this might work:

void left(char a, char b)
{
  // Note the time
  unsigned long turnStart = millis();

  // Start the turn
  analogWrite (E1,a);
  digitalWrite(M1,LOW);
  analogWrite (E2,b);
  digitalWrite(M2,HIGH);

  // Diddle for 300 milliseconds
  while(millis() - turnStart < 300)
  {
     // Don't do a thing...
  }

  // Stop turning
  analogWrite (E1,0);
  digitalWrite(M1,LOW);
  analogWrite (E2,0);
  digitalWrite(M2,LOW);
}