Time difference between button press

Hi! I am using a Micro Maestro 6-Channel Controller with 3 buttons, b1, b2 and b3. Each of them controls a servo, s1, s2, s3 What I want is: When I press b1, s1 starts functioning. Then after some time dt I press b2 and s2 starts too. But when I press b3 I want s3 to starts after the specific time dt. Any idea how to accomplish this? Thanks a lot

You should be able to use the get_ms command to achieve that type of time measurement effect. If you call the get_ms command when you press button 1, it will put the current millisecond timer value on top of the stack. Then, calling it again when button 2 is pressed will put the new current value on top of that. Next, subtract them (you will probably have to swap them first) to get the difference in time between when the two buttons were pressed. This difference will now replace both of the previously stacked values and be the top value on the stack, and you can use it for your delay.

Also, I am not sure what you mean when you say that the servos will start “functioning”, but doing multiple things concurrently, (e.g. moving servos around while running a timing code) could be difficult.

-Brandon

I mean, the normal move of moving the arm of the servo, nothing more. Thanks for your reply, what I needed =)