Dec-06-2024, 07:20 AM
(Dec-05-2024, 03:23 PM)deanhystad Wrote: It is unclear from your description, but it sounds like the joystick will be some kind of integrator. The longer you hold the joystick up/down, the more it changes some value. Is that correct?All Joystick I tried so far send a float value from -1 to 1 with zero in middle for X and Y (like a potentiometer).
If so, I think your problem is opposite what you state. I think you need to add a delay to reading the joystick and sending the osc command. Something that makes the time between consecutive commands the same. I would use a threading timer to periodically call the send_OSC() function.
As far as sharing information, you can do that with a globally scoped variable, or you could write your code using classes and use instance variables. If you don't like either of those, you can use a mutable container object, like a list or dictionary.
A dataclass would be a great choice for this, but I don't think those are available in micropython.
My normal proffesion is technician on a theater with a motorized hoist system. They use a square pulse to sync the movment between couple of motors to synchronize them. My idea is recalculate my float-value to trig against a square pulse and send my value 1 or -1... or if i just use couple of time variables, but I would keep my latecy as low as possible. :)