|
Re: Servo control with a joystick
Quote:
Originally Posted by Robototes2412
Thanks!
Just to verify:
Code:
public double convert(double input) {
//newValue = newMax + (newMax - newMin) * (oldValue- oldMax) / (oldMax - oldMin)
input = 1 + (1 - 0) * (input- 1) / (1 - -1);
return input;
}
|
You can verify it by plugging in your input extremes (-1 to +1). I haven't had my coffee yet, but it doesn't seem like -1 converts to 0. Why not try the one I posted? KISS
__________________
I don't need a signature.
|