Best practices for creating long programs by trial and error Pro Preview

Now that you have tried and solved a challenge involving a series of instructions, we would like to share with you a few best practices.

  • #413
  • 15 Mar 2017
  • 2:51

Try blocks one by one

It is a bad practice to place several blocks before testing your program. The problem is that when there is an error, you can't pinpoint which block causes the problem.
 

Understand the challenge

In order to solve a task correctly, you must make sure you understand what is expected from you. So make sure you articulate the way you understood the challenge and ask your teacher if that understanding is correct.
You can also ask us in the comments section below.
 

Test each step of the program with the robot

This is the most important message we have here! Follow this algorithm:

  • Place one or two blocks in your program and adjust them;
  • Download the program from the computer to the robot;
  • Place the robot on the floor and place it at the marked starting position;
  • Select the program from the brick menu and start it;
  • Observe the results and assess if the robot behaves as desired:
    • If the behavior is "correct", as desired, carry on
      • Add new blocks to the program, extend it;
    • If there is an error, it is in the new blocks that you just added.
      • Correct the error and test it again.
         

Use the download option of the software

This way you have control where and when you start the robot. If necessary, you can start the program from the brick several times.

English

When building a program with a series of instructions at the end we have the following program.

That was the Yo-yo challenge. And there are a couple of best practices of how you should develop such programs and in this video I'd like to discuss these best practices.

Now, this is a complex program because it involves several blocks. And it is not a good idea to place all the blocks at once and to try to run the program because it will not work correctly. So, you should try do develop the program in small steps. First, the most important thing, understand the challenge. You can ask for some clarification from the instructor, from the teacher. You can also comment below the video or look for answers in the comment sections. So, you should understand the whole challenge. Then create a program using only one or two blocks. Download the program from the computer to the robot. And you can use Bluetooth, you can use USB. But after you've implemented a program with one or two blocks you just download this program to the brick. And now I'll download my program right here.

Just download without running. Then you take the robot, place it on the floor where you have the starting position and from the menu you select the program that you want to run. And press the button.

So, we have the first two blocks of the challenge. We observe them and we decide, okay, this is something correct. Then we can extend this program. If the behavior is not correct, we can change it. But if it is correct, we just extend it. In this way we have in small steps developing the program. And we know exactly where the error is if there is an error. Because we don't move forward until we have the small fragment of the program working, these small one or two blocks. That's why it's important that you use the download option. Because you can actually take the robot, place it, run and then observe the behavior of the robot.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for EV3 Phi. Introduction to robotics with LEGO Mindstorms
  • 92
  • 220:20
  • 36
Image for Instructors Remote Training
  • 136
  • 280:11
  • 156
Image for How to make the robot move
  • 24
  • 0
  • 11
  • 3d_rotation 0
Image for Level A1. Introduction. Robotics with LEGO
  • 142
  • 133:42
  • 187
Image for Lesson 2 - Yo-yo challenge
  • 18
  • 3
  • 8
  • 3d_rotation 1
Image for Robotics with LEGO - Level 1.0 - Adventure in Space
  • 126
  • 123:52
  • 150
Image for Lesson 1 - Moving like a Yo-Yo
  • 19
  • 4
  • 9
  • 3d_rotation 1
Image for Robotics with LEGO SPIKE Prime - Level A1
  • 64
  • 30:30
  • 76
Image for Lesson 2 - Tidal waves
  • 10
  • 5
  • 12
  • 3d_rotation 1