<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Good day all,<br></div> What is the opinion of this esteemed group on the best/proper/whatever way to get the measured value from some external input from a micro in C.<br></div><div>By measured value I mean something like ADC, OW temp sensor, I2C sensor state etc.<br></div> I am considering the following three scenarios in increasing order of goodness:<br></div>1) function returns the measured value indicating error by out of range result (i.e 0xFF for  8 bit int)<br></div><div>i.e:<br>...<br></div><div>unit8_t readSomePin(void); // 0xFF indicates error<br><br></div>2)  function returns the measured value indicating status of measurement in another extern. variable<br>...<br></div>extern uint8_t readSomePinStatus;<br>unit8_t readSomePin(void);  // Status in readSomePinStatus<br><br></div>3) function returns status, the value is stored in an argument variable:<br>...<br></div>unint8_t readSomePin(uint8_t *returnedValue);<br><br></div>So, what is best? Is there a better way? This could no doubt also be done with Structs, but seems like overkill to me.<br><br></div>Cheers<br><br></div>jasper<br></div>