situation: I'm currently working with some fellow students on a "school" project involving Lego Mindstorms. We're using Lejos to run java programs on the Lego robot.
Through Libraries we have an object 'sensor' that updates a variable every 20 ms. I can read this variable using the method 'readValue()'. I've written the following thread to sample this sensor at 20ms:
problem Our mentor however, isn't happy with the "Thread.sleep(20)" method we're using to achieve the sampling effect (because of the inaccuracy of the sleep method). He hinted that there was a better way to do this. Could you suggest some other better method or at least give me a hint in which direction to search? I'm very ill experienced in Threads.
Thanks in advance for your advice!
Give me golf clubs, fresh air and a beautiful partner, and you can keep the clubs and the fresh air.