I’m programming a knob that has an arrow the position of which is defined from an arc number.
I’m looking to find a way to convert this arc number to a number that will represent a temperature.
The minimum the arc number will be is 1.3 and the maximum will be 1.7.
1.3 needs to equal 40 and 1.7 needs to equal 99.
Is this possible?
If it’s linear, you can use the following formula to allow for any minimum and maximum:
The
* (to_max - to_min) / (from_max - from_min)bit scales the range from thefromrange to thetorange. Subtractingfrom_minbefore and addingto_minafter locates the correct point within thetorange.Examples, first the original:
Then the one using -1.3 as the lower bound as mentioned in one of your comments:
This answer (and all the others to date of course) assume that it is a linear function. That’s by no means clear based on your use of words like “arc” and “knob” in the question. You may need some trigonometry (sines, cosines and such) if it turns out linear doesn’t suffice.