Thank you for sharing,,
some minor points to improve your code
if( inByte == 'R' ) // you can use that char to compare directly
...
if (current_range_reading <= 300) //This will catch other faulty readings too, they may not happen but makes the sketch more robust
{
Serial.println("too close!");
}
else if(current_range_reading >= 5000) //idem
{
Serial.println("too far!");
}
else
{
Serial.print("Range (mm): ");
Serial.println(current_range_reading); // no need to convert to string
}
The code assumes that when you have 6 or more chars in the buffer that it is a nice "Rxxxx\n", but what if the Arduino during startup missed the first (or two) char?
You need to adjust your code to wait until there is a 'R', and then wait for 5 chars etc.
Do you have a link to the datasheet of the sensor? People might be interested in that too.