We learnt how to use conditional statements (switch block) and wait block, but when is used switch block and when wait block? How can we map the task with the program?

To access the full video please subscribe to FLLCasts.com
- #1393
- 09 Jul 2019
Probably you have heard of the term "programming language". It refers to absolutely all robot instructions written by people. Even the blocks we use to program the LEGO EV3 Mindstorms is a kind of programming language, even though they are more like drawings than written language. Like al other languages programming languages can be translated to other programming languages.
But who can do that?
Everybody! For example, when we have the following program:
We read: move motor B and C forward for 1 rotation. This will be our translation. Now look at the following program:
It is read as follows: If the touch sensor is pressed, move motor A forward for 1 rotation, else move motor B forward for 1 rotation.
Look at this program too:
Here a wait block is used and the program is read as follows: Move motor B and C forward until the touch sensor is pressed and then stop motors B and C.
The same way we read programs, we can write them too. For instance if we have the following task - "Program the robot to move forward, until black line.". We know that in order to solve the task we need to use wait block.
Here we can arrive at a conclusion. The rule for when to use conditional statement (Switch block) and when wait block is when in the task there is the word "if", switch block should be used. When in the task there is the word "until". wait block should be used.
This rule as every other rule has its exceptions, but it is true in most cases. Sometimes the task can be formulated both using if and until. In such cases you will need to figure out which block should be used!
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Robotics with LEGO - Level 1.5 - Spy games
The second level of the Robotics with LEGO curriculum for students from fifth to twelfth grades.
Students build multiple robots with thread chains and become familiar with the physical concepts of momentum and center of gravity. The concept of gears, their use and basic constructions involving gears are studied.
The new concept of "condition" is introduced in programming. Robots are becoming smarter as they can make complex decisions on their own. "Spy robots" follow their targets and avoid being noticed. This level introduces the light sensor which the robots use to recognize the colors of the objects they are looking for. Robots can stop on a black line and follow a route marked with a colored line on the floor.
The spy's most complex mission in the end of the level is to turn into a sumo wrestler and defeat any other robot in the ring.
- 56
- 12:47
- 136

Level B1. "Spy gadgets". Robotics with LEGO
The third level of the Robotics with LEGO curriculum for students in second, third or fourth grades.
In these lessons, we stress on more complex and challenging robots. The concept of Condition is introduced. Students learn about physics concepts of inertia and center of mass. Robots with two sensors are built and students program both of them. Programming becomes more complex as robots now can make complex decisions. "Spy"-robots sneakily follow their targets, trying to be undetected.
- 30
- 7:30
- 108

Finding "interesting" places
We learnt how to use conditional statements (switch block) and wait block, but when is used switch block and when wait block? How can we map the task with the program?
- 1
- 0
- 3
- 3d_rotation 0

Level B2. "Military Technologies". Robotics with LEGO
The firfth level of the Robotics with LEGO curriculum for students in second, third or fourth grades.
The students build many robots with chain-treads. The Color Sensor is introduced and robots use it to recognize the colors of the objects around them. Students learn about gears, basic gear constructions, and their application. Robots now can stop on a black line and can follow a line using their sensor.
- 37
- 6:37
- 111

Lesson 4 - Third black line
Introduction
Key part of the warfare is the intelligence. If two armies are at war, usually one of the two is smaller and will want to apply some secret strategy in order to win the war. In that case the larger army would like to figure out that strategy in order to counter it. Today we build a scout robot. The task of the robot will be to follow an army and find out where is it positioned and what is its plan for action.
Do you know what is key for scouts? Why are they needed?
In order to be able to spot the enemy, the robot will need to follow their tracks. People leave all kinds of tracks and a whole army will leave even more! For instance they would have a campfire, or throw out their cans of beer and most certainly they will leave a lot of trampled grass. However, if they are smart they will cover most of their tracks and that is why our robot should be able to outsmart them!
- 2
- 4
- 3
- 3d_rotation 1

Robotics with LEGO - Level 4.0 - Kinesthetic and Memory Game (in development)
The seventh level of the Robotics with LEGO curriculum for students in sixth or seventh grade.
In this level, student develop a memory training game. The player must remember series of actions like press a button, shake a pole, pull a lever, show one of many colors. In order to program the game, students use many variables and modify their states. Students create their own custom sounds and images, in order to reflect their own personality in the game. In the end of the level, the game stores top scores even after a full shut down with the help of text files.
- 59
- 2:58
- 200

Припомнете си как се работи с условни оператори и кога се използва
Sometimes you need to evaluate the value of a sensor or some other data and depending on the value to execute one action or other. In a way we have achieved that so far, using the switch block, but we have had only two cases - if the statement is true do one thing and if the statement is false do another. However, sometimes we need more than two cases and then we use the switch block as a switch statement.
- 3
- 0
- 0
- 3d_rotation 0