$$ \newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} \newcommand{\ceil}[1]{\left\lceil{#1}\right\rceil} \renewcommand{\mod}{\,\mathrm{mod}\,} \renewcommand{\div}{\,\mathrm{div}\,} \newcommand{\metar}{\,\mathrm{m}} \newcommand{\cm}{\,\mathrm{cm}} \newcommand{\dm}{\,\mathrm{dm}} \newcommand{\litar}{\,\mathrm{l}} \newcommand{\km}{\,\mathrm{km}} \newcommand{\s}{\,\mathrm{s}} \newcommand{\h}{\,\mathrm{h}} \newcommand{\minut}{\,\mathrm{min}} \newcommand{\kmh}{\,\mathrm{\frac{km}{h}}} \newcommand{\ms}{\,\mathrm{\frac{m}{s}}} \newcommand{\mss}{\,\mathrm{\frac{m}{s^2}}} \newcommand{\mmin}{\,\mathrm{\frac{m}{min}}} \newcommand{\smin}{\,\mathrm{\frac{s}{min}}} $$

Prijavi problem


Obeleži sve kategorije koje odgovaraju problemu

Još detalja - opišite nam problem


Uspešno ste prijavili problem!
Status problema i sve dodatne informacije možete pratiti klikom na link.
Nažalost nismo trenutno u mogućnosti da obradimo vaš zahtev.
Molimo vas da pokušate kasnije.

Project Task - Robot Movement

We will begin our adventure with a simple program, which allows the robot to move forward for 2 seconds and then moves backward for 2 seconds.

The first step in our example is to start the motor. We need to select the block tankmotor from the category Motors, and drag it onto the work surface and into the block start. Initially, we have to decide to which ports we will connect out motors. We have already mentioned that the EV3 has four ports for motors - A, B, C and D.

In our case motors are connected to the ports B and C, and their speed 50%. Since, based on the setup of the task, the robot should move forward for 2 seconds, we need to click on the plus sign on the block tankmotor, this will give us the option to choose the manner in which the robot will move.

In our case, we need to choose the option “seconds”.

_images/7.png

After this, we need to adjust the duration of the robot’s movement by entering 2 in the input field broj. This way, we will allow the robot to move for 2 seconds.

The look of the code, which allows the robot to move for 2 seconds:

_images/9.png

Finally, to allow the robot to move backward, we need to set the motor speed value to be negative. We will set the value at -50.

The look of the final code:

_images/11.png

Connect the EV3 Brick to the computer via USB cable and click on the download button located in the bottom of the screen. Follow the instruction on how to save the program on the EV3 Brick.

Download the .uf2 file to your computer by clicking the button dugme1. By dragging the file onto the EV3, it is ready to start working.

To demonstrate how the robot moves, we will give another simple example of a program, which allows the robot to move from the starting line to the finishing line, and back. The distance to the finish is 50cm.

_images/11_.png

Based on the setup of the task, the robot is moving forward 5 rotations (360 degreed = 1 rotation), therefore, we need to drag the block tankmotor from the category Motors, onto the work surface and into the block start.

In our case, the motors are connected to the B and C ports at 50% speed. Since, based on the setup of the task, the robot moves 5 rotations, we need to click on the plus sign on the block, which will open the option for choosing the manner in which the robot will move. This time, we need to select the option “rotation”. Then, we need to set the duration of the robot’s movement by entering the value 5 in the input field. This way, the robot will move for 5 rotations.

The part of the code, which allows the robot to move 5 rotations:

_images/121.png

We will use the block to rotate the robot. Turning is defined as the change in the speed of one motor in relation to another motor, or more precisely, if we want to make a quick or sharp turn to the right, the left motor must run at least twice as fast as the right. In order for the robot to make any type of turn, we need to use the input field turn ratio. If we want the robot to turn left, we will set a negative value, and if we want it to turn right, we will set a positive value. To allow the robot to come back from the finishing line to the starting line, we will use the same block. To stop the functioning of all motors we will use the block blok1.

The look of the code, which allows the robot to move from the starting to the finishing line:

_images/152.png

Download the .uf2 file to your computer by clicking the button dugme1. By dragging the file onto the EV3, it is ready to start working.