The more advanced task is to more in a polygon. This would require calculating the degree of each of the turns and RobotC is a language in which you could implement this math calculation very easily.

**#341**- 15 Apr 2017
- 3:24

### Polygon

A polygon is a closed figure. For this task start with a polygon that has all of its angles equal and all of its lines with the same length.

### The program

Build a program where you set a variable to, lets say, 3, and this will make the robot move in a triangle. For the same program if you set the variable to 4 the robot moves in a square, Then for the same variable if you set it to 5 it should move in a pentagon.

After you implement the program set the variable to 17. How would the robot behave? Definitely, take some videos of your robot and share them with us in the comments section.

### English

In this video we'll present a little more advanced task. Why? Because sometimes with these robots you can do very interesting calculations. And to introduce you to these calculations what you should do is try to implement a program that makes the robot move in a figure but this figure is with a specific number of angles. So, implement a program where you type 3 and this robot moves in a triangle. You type 4 and this robot moves in a square. Then you type a random number like 19 and this robot moves in a figure with 19 angles. 19 equal angles. And it is a very easy program and I would like you to try to implement it yourself. Let's look how you should approach this problem.

Until now we haven't discussed the use of variables. Only some functions and some loops but not variables. So, I understand that this is a little more advanced task that you can at least try to solve. And we'll try to prepare a solution for this task somewhere below the video that you can download, see and work from there. But the basic idea is the following. When you have the robot it moves forward and it's static then you just turn right. And this turning right will turn the robot to 180 degrees but if you don't want to move in square but for example in a figure with seven angles then you must not turn to 180 degrees but to another value. And the way you turn to another value is don't wait for 1500 milliseconds so for a second and a half. You should wait another number of seconds. Again, the basic idea is that as you increase the number of angles you could define it like int 'ang = 11' and then set this value in the loop and then what you should do is do a calculation here. Like ang ... like divided i ... and from there you receive a single value for waiting. And in this way you implement a program. Try to do it yourself. It's a little bit more advanced. It you can, comment below and we'll also try to implement the program upload it for you so that you can run it. The basic idea is to learn how to do some calculations based on this two variables.

## Курсове и занятия включващи този Урок

Този Урок е използван в следните курсове и занятия.

### VEX EDR introductory course

Designed to get students started with VEX EDR and RobotC. The robotics set is not very easy to use and offers its challenges. In the course we take a step-by-step approach to moving, turning and using sensors. A big part of the course is about programming and using the RobotC software for the Cortext controller.

**This course is still under development and constantly change and extended.**

- 43
- 69:49
- 0

### Move in a square. What are these things called loops?

In this tutorial we would introduce you to the concept of loops using this VEX EDR Robot. As a final result we would have a program that makes the robot move in a square and not by repeating the same instructions for move and turn four different times.

- 6
- 0
- 0
*3d_rotation*0