By the way, Paco, I didn't put speedfinalValue into my equations.

Here it is:

if (sensormappedValue < 128)

speedValue = (int) ( 0.5 + speedstartValue + pow(sensormappedValue/127.0, gammaStart) * ((speedfinalValue - speedstartValue) / 2.0) );

else

speedValue = (int) (0.5 + speedfinalValue - pow((255 - sensormappedValue)/127.0, gammaFinal) * ((speedfinalValue - speedstartValue) / 2.0));

Leave the 255 there; it relates to input obviously.

Also both gammaStart and gammaFinal are always >= 1. Start them both at 2.0.

When you're ready to make it 3 sections as I described, the above remain the same except that there will be two tests on sensormappedValue.

If the sensormappedValue (mislabeled and now corrected in my previous post!) is not within either extreme range, it is in the middle linear region and there you can use the map function.

If for the 0-255 sensor range say you want the linear mid region to be 75 thru 175,

you would use the upper equation to compute speedValueMidStart for sensormappedValue = 75 and

use the lower equation to compute speedValueMidEnd for sensormappedValue = 175

Then for the midrange,

speedValue = map (sensormappedValue, 75, 175, speedValueMidStart, speedValueMidEnd);