Sounds reasonable, but consider adding a sync() command to the Thread-loop. And you probably need to include the get_analog_in() inside the Loop, otherwise you would keep sending the same value.
Hi jbm. Thank you for the fast response. Im curious, why i have to add the sync() command in the thread loop ? And another thing is. What is the value range i get with get_analog_in() is it a float between 0.0 and 1.0 ?
sync()takes physical time, and hence relieves the thread from running away, consuming all processor resources.
Also, you probably do not need to adjust the speed slider at sub-millisecond precision, so adding some small delay could also work. I.e. 100 ms (sleep(0.1))
The return value of get_analog_in() is explained in the URScript Manual.
The command needs a line feed character to execute, why you are sending byte 10.