When should you use switch block and when wait block? Pro Preview

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

Subscribe

  • #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:

content picture

 

We read: move motor B and C forward for 1 rotation. This will be our translation. Now look at the following program:

content picture

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:

content picture

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

Image for Robotics with LEGO - Level 1.5 - Spy games
  • 56
  • 12:47
  • 135
Image for Level B1. "Spy gadgets". Robotics with LEGO
  • 30
  • 7:30
  • 108
Image for Finding "interesting" places
  • 1
  • 0
  • 3
  • 3d_rotation 0
Image for Level B2. "Military Technologies". Robotics with LEGO
  • 37
  • 6:37
  • 111
Image for Lesson 4 - Third black line
  • 2
  • 4
  • 3
  • 3d_rotation 1
Image for Robotics with LEGO - Level 4.0 - Kinesthetic and Memory Game (in development)
  • 59
  • 2:58
  • 200
Image for Припомнете си как се работи с условни оператори и кога се използва
  • 3
  • 0
  • 0
  • 3d_rotation 0