I still need an answer to the above question, but I have something to add to it.
If I do this;
leftAdcVal = joystick[0]; // range 0 to 1032
leftMotorVal = leftAdcVal - 513; // range -511 to +510
// subtracting 513 (rather than 512) ensures that no later value will exceed 255
Serial.print("LMotor = ");
Serial.println(leftMotorVal);
My serial monitor spits out values I would expect given my joystick max and min limits.
LMotor min is -98 LMotor max is 91.
If I change that snippet to this;
leftAdcVal = joystick[0]; // range 319 to 567
leftMotorVal = leftAdcVal - 64; // range -64 to +64
// subtracting 513 (rather than 512) ensures that no later value will exceed 255
Serial.print("LMotor = ");
Serial.println(leftMotorVal);
The serial output falls back to giving a max reading of 540 and min of 352.
I may just be a very slow school teacher trying to learn how to code, but to me math is math and should give me predictable results. What's up with that?