I've got an IR sensor which writes its current information to a token which I then interpret in a C# application. That's all good -- no problems there, heres my code:
SetLabelText(tokens [1],label_sensorValue);
sensorreading = Int32.Parse(tokens[0]);
sensordistance = (mathfunctionhere);
Great. So the further away the IR sensor is from an object, the lower the sensor reading (as less light is reflected back and received by the sensor).
My problem is in interpreting that length. I can go ahead and get lets say "110" as a value when an object is 5 inches away, and then "70" as a value when an object is 6 inches away. Now I want to be able to calculate the distance of an object using these constants for any length.
Any ideas?