How to do a sleep function?

I know you can’t use it as the entire robot will be unresponsive, but is there any equivalent, as in Button press, then 3 seconds later preform task?

Keep track of the start time in a variable. Use a loop and in every iteration, check if the current time is 3 seconds more than the start time. If it is, you can then do whatever you wanted to do

1 Like

See Java Timestamp Actions

1 Like

If you are using Command-Based paradigm, use a command group assigned to the button.

First command in the CommandGroup would be

addSequential(new WaitCommand("Wait for doohickey", 3);
addSequential(new DoTheThingYouWantedCommand());
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.