[Solved] You just need to think a little bit to help me find the solution


If I understood your question correctly then maybe this?

x = (1 - rpm/rpm_max)*255

UPDATE: as mentioned by CandiedOrange – rpm and rpm_max need to be float or double for it to work. Otherwise the value of x would simply switch back and forth between 0 and 255.

3

solved You just need to think a little bit to help me find the solution