Serial motor control

  int* command = (int*)input;
  // check commands
  // note that the two bytes are swapped, ie 'RA' means command AR



  switch(*command) {

WTF? Casting a char pointer to an int pointer is really NOT a good idea. The pointers don't point to the same size values. The values being tested then are NOT ints!

  case '2j':
  case '2J':

The Arduino does not support multibyte characters. These cases will NEVER happen.

  while (charin>46 && charin<119 && charin != LineEnd1 && charin != LineEnd2 && inputLength < BufferLength);

There's really something wrong with the logic when there are this many conditions for stopping or continuing. Comparing a character to a numerical value is silly. Do you have a 46 key on your keyboard? A 119 key? My keyboard seems to be missing them.

  inputBuffer[inputLength] = 0; //  add null terminator

Wrong. The array should be NULL terminated ALL the time, not just when this overly complicated do/while (which is the wrong construct, anyway) ends.