How to make the robot stay idle while the program is still running.
- 27 Apr 2017
The Wait block
Go the orange Flow palette and take the second block which is the wait block. The default mode of the wait block is to wait for some time. You can set the number of seconds the robot should wait before the program continues to the next block.
You can think of the wait time block as a "pause".
The correct way to implement moving forward, wait and return back is to use a wait block. The goal of this wait block is to make the robot wait, just be there, stay for a number of seconds.
In the software we take a display block, we put on a smiley face, big smile, then we move forward with the steering block for 1 rotation and then we return back with the steering block. You remember that returning back is moving -1 rotation.
The new block that we'll introduce now is not in the green palette, it's in this kind of an orange palette. And we take the wait block. Just drag and drop. What this block will do is make the robot wait for a number of seconds. How many seconds? We set this here. It's just 1 second. So, we put on a big smile, move forward then wait for a second and then move back. It's not a good idea to be very rude if you are a robot and you try to greet a stranger. Just don't be rude. Wait, so the other could reply and then return back. That's our program. We'll use the wait block in many programs from now, it's a very simple block, it's just waiting for a number of seconds. Download and run.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons