If this is meant to be a carriage return character
Serial.write ('r');
it should be
Serial.write ('\r');
...R