How to read data form an UART
<p>I have a sensor connected via uart to an mcu. The output of the sensor is ascii chapital R followed by four ascii character numbers and ends with a carriage return. e.g. R1234CR</p>

<p>Below is code for reading one character at a time from the uart. </p>

<p>I'm trying to write a function that when it detects the capital R and it puts the next four characters in an array.</p>

<p>I have most of the function written below but I'm struggling with the logic flow.</p>

<p>Also how can I return the array?</p>

<p>Thanks</p>