===== Simple linear conversion ===== A very simple method (no floating point, no algebraic formulas) for linear conversion of sensor output data to human-understandable units. === Example 1, temperature === Two points are given: Sensor output 400 and 1200 correspond to 10 and 36.3 degrees Celsius respectively.\\ To get rid of floating point, we calculate Celsius in tenths of degrees: Sensor Celsius 400 100 1200 363 (800) (263) (Distance) Let's take: SensorZ = the given sensor value closest to zero (400) CelsiusZ = the corresponding Celsius value (100) SensorDist = distance between the two sensor values (800) CelsiusDist = distance between the two Celsius values (263) Then the conversion looks like this: : >CELSIUS ( sensor -- celsius ) SensorZ - CelsiusDist SensorDist */ CelsiusZ + ; The working forth definition is: : >CELSIUS ( sensor -- celsius ) 400 - 263 800 */ 100 + ; NEGATE must be inserted after */ when increasing sensor values correspond to decreasing Celsius values. === Example 2 === Sensor Celsius 400 363 1200 100 (800) (263) (Distance) The forth definition: : >CELSIUS ( sensor -- celsius ) 400 - 263 800 */ NEGATE 363 + ; ( an,jan2025)