Percentage mapping to variable help


I have a display and buttons set up to select and show a sensitivity value between 0 and 100% to the user. My code however needs to work with the sensitivity value inverted and within a range of 300 to 4000. so for example it should map like this.

0% = 4000
50% = 1800
100% = 300

I cant think of a way to calculate a linear relationship. Can anyone help me with an elegant solution please?

thanks in advance

take a look here :nerd_face:

Brilliant! Thanks that worked a treat!

Who would have thought the mapping function I needed was called map!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.