I have this code that give my the desired curve on a reading that is from 1 to 64, but I can't figure out how to get the same result for the values -1 to -64
The motor still has a speed, yes?
I'm no math whiz, and I don't know what circuit you're using, but can't you just negate the value(s) returned from the function? In other words, feed it athe abs(motor_speed), then negate the reult and fee it to motor_speed.
I haven't tested that function but it appears to have explicit support for negative ranges. Have you got a sample sketch we could run showing the incorrect values when you try to apply it to a negative range?
If you can't be bothered figuring out what the problem is, you could just negate the input motor_speed if it was negative, and then invert the result too.
This doesn't fit the rules:
originalMin - the minimum value of the original range - this MUST be less than origninalMax
originalMax - the maximum value of the original range - this MUST be greater than orginalMin
SouthernAtHeart:
-1 to -64 is the reverse speed...
Yes, of course, but a value of, lets say, -10 is just the same speed as +10, but in the opposite direction, no?
If you want to increase the reverse speed, you send it a more negative number, right?
It would be worth a shot to try it. Just make all the values you pass the same as you would pass if it was a forward speed. Negate the result and set the speed. See if it works. It's what I would try right away, partly because it makes sense, and partly because it's dead easy to try.
SouthernAtHeart:
In reference to this code that changes the curve or scale of numbers: Arduino Playground - HomePage
I have this code that give my the desired curve on a reading that is from 1 to 64, but I can't figure out how to get the same result for the values -1 to -64