Dec-10-2017, 06:20 AM
(Dec-10-2017, 05:04 AM)Mekire Wrote: This all you are asking for?
That's exactly what I was looking for! Thank you very much for the to the point example.
The value "127" can be substituted with a variable and an additional parameter to the function can be added to make it usable with other max values other than 127 to make it more portable.
def scale(joy_val, max_val): return int(round((joy_val+1)/2.0 * max_val))so it can be called with
scale(joystick.get_axis(0), 127)and function just the same.