How to make the robot wait and continue?


#1

I have written a obstacle avoidance code and I want it so when it detects let’s say a hand with the PIR sensor it waits 10 seconds and continues the obstacle avoidance mode. How can I achieve this?


#2

You would need to check from an obstacle is detected, stop movement, then use either a wait-until block based on the current time plus 10 seconds (blocking call) or if you want the rest of the code to keep running, you’d need to do something similar to using the ActionTimer object (link) in Scratch blocks.


#3

Thanks!


#4