top of page

FIRST STEPS

Welcome

I am Martina, and I am here to help you take your first steps with the robot.

In this lesson, we will start working with movement blocks to understand how the robot reacts to our commands and learn to perform simple maneuvers.

At the end of the lesson, we will also do a small analysis of the difficulties we encountered and see what solutions can make programming movements easier.

Again, I recommend reading this guide while trying to work directly on your device, don't hesitate to experiment!

Martina P.

Martina

Intro

In this lesson, we will create a small figure-eight course that we can build by placing two obstacles on a table. I used two plastic cups, but you can use anything.

When we want to program a course, the first thing to do is imagine the course and understand which and how many commands we need to give to the robot.

The first few times, I recommend doing this work on a sheet of paper to clearly visualize the course.

In our case, the course consists of 8 straight segments that we can complete using the Move forward block.

In addition to these straight segments, we need to execute 7 90° turns, which we will try to perform with different commands.

Now that we understand we need 8 blocks for the straight parts and 7 for the turns, we can start writing our program.

blocks

Starting Condition

First we need to decide when to run our code. Typically the choice is between: When the program starts and When the button is pressed . The second is faster because the program starts taking some time to run.

Let's start by placing the When button is pressed block and change it to Released. This allows us to not interact with the robot when it starts moving. In general, when we start a movement, it is always better to do it by releasing the button instead of holding it down.

We add a Set Motion Motors To block to tell the program which ports are connected.

We set the movement speed to 30% with the Set movement speed block. This gives us a slow and precise movement that would otherwise not be possible with too fast movements, because they often cause the wheels to slip.

To stop the movement of our robot without terminating the entire program we can write a stop condition. As before, we will execute this part of the code when the other button is pressed.

We insert a When button is pressed block to which we connect a Stop Other Stacks block followed by a Stop Motion block.

This allows you to interrupt the execution of any other part of the program and stop the motors.

blocks
blocks
blocks
blocks
blocks
blocks

Movements

To start moving our robot, we insert a Move forward block in which we need to select the appropriate measure.

To execute the first turn, we place a Move straight block, in which it is possible to select a curved trajectory.

Our goal is to rotate our robot by 90°. To do this, we need to adjust the trajectory and the number of rotations. A common mistake is to modify the trajectory to change the number of degrees of a turn. The correct procedure is to first establish a trajectory and then adjust the number of rotations to achieve the desired rotation.

We set the trajectory of the block to -100 to perform an in-place rotation and adjust the rotations to reach 90°.

blocks
blocks
blocks
blocks
blocks

Now it's your turn!

Now try to complete the course around the two obstacles on your own by inserting the blocks we have learned together.

You might have difficulties making precise turns. It is often challenging with this type of block to find the exact measure of the turns, and sometimes the program may not behave the same way each time it is executed.

To solve these problems, we need to introduce sensors into the programming. In the next lessons, we will learn how to improve the movements of our robot using the gyroscope and color sensors.

blocks
bottom of page