Sitting in a small Raspberry Pi project to controll stuff in lightingconsoles with a Joystick. Has some issue with timing and wondering if I should separate the part that reads the position of the joystick and the part that sends OSC-commands to my lightconsoles. My first test when everything was in the same loop, I wasn't happy with the timing.
Short version of my project, because I don´t wnat someone to solve my project. Just give me some hints. ;)
What is the fastest way to move floating values between my "while True:" and my "def send_OSC():"? Do it work with globals or should I memory allocate my values (if I can do that in Rasperry Pi)?
EDIT: Because I only need to send value 1 and -1 to my lightingconsoles I'am going to let my joystickposition be a "timertrigger" when to send my next OSC-command that says 1 or -1.
Short version of my project, because I don´t wnat someone to solve my project. Just give me some hints. ;)
import OSC import threading #initialize OSC send_to_adress = '10.101.11.27', 8000 c = OSC.OSCClient() c.connect(send_to_adress) def send_OSC() # Read floating joystick value for X and Y if -0.2 <= LeftJoystickX <= 0.2: # Send OSC for X-movment threading.Thread(target=send_OSC).start() while True: # Save floating joystick value for x and y to memorySo I have my own thread´s that checks if values is outside dead limit´s on my joystick and start sending OSC. Don´t bother the if < and >... I solved it in the final release. ;)
What is the fastest way to move floating values between my "while True:" and my "def send_OSC():"? Do it work with globals or should I memory allocate my values (if I can do that in Rasperry Pi)?
EDIT: Because I only need to send value 1 and -1 to my lightingconsoles I'am going to let my joystickposition be a "timertrigger" when to send my next OSC-command that says 1 or -1.