joystick logic question w/ notes

    Jun 09 2014 | 1:44 am
    hello max patchers! question for you.
    i'm trying to tame a joystick and can't come up with an elegant solution for this problem. the joystick produces an integer from 0-255 (left to right). when not in use the joystick should rest in the center of that range. upon releasing the joystick, it doesn't fall back to the center of the integer range, and for further complexity, it's very sensitive and constantly shifting around 10 integers even when not in use. i've come up with a rough solution as for how to handle this but eliminates several integer values from use, so i'm wondering if there's a more strategic way to handle this. a [line] or slew function won't work as that will again produce constant wiggling integers (even if that joystick is not in use). i suppose i could look for a certain amount of change before outputting the data to other max objects, or something along those lines. the goal is to reset the joystick to the center of the range while preventing the constant integer wiggling.
    here's the patch with detailed notes:

    • Jun 09 2014 | 2:59 am
      Maybe an idea would be to store the value from the controller in an int and only bang when you want to read ie you could write a conditional statement saying if it goes over or under a certain threshold then tell it to output. I've just tried messing around, will have another crack in the morning as it is four o clock..!