We start with the previous program where we made the robot move forward and turn. We continue in this tutorial with repeating the same RobotC instructions four times. Our goal is to make the robot move in a square.
- #338
- 12 Apr 2017
- 1:26
Copy/paste the instructions
The simplest and most obvious solution is to just copy and paste the code 4 times. This would make the robot move and turn four times. This is of course not the best solution. And it is not even right. What you have to remember is that every time you do a copy paste in a software program you are introducing a bug. If you ever wonder why are there so many bugs in software products that is because naive software developers like to copy and paste stuff. Which is wrong.
English
In the previous video we finished with implementing moving forward and turning. The robot was working like this. Move and turn. Our goal is to build a square and what we'll do now is just repeat this move forward and turn 4 times. Let's do this in the software.
Implementing a square when you have the code for move forward and for turning right is very simple. We can just copy this code. Now, it's not very intelligent to copy it and we'll find other ways in the next video but for now let's just copy this and paste it. And now we have move and turn 4 times. Let's number them. Move forward 1, turn right 1. Then 2. Then 3. And then 4. This will be a little difficult to see it on the camera but we'll find a way. Let's see how this program behaves when downloaded to the controller.
Курсове и занятия включващи този Урок
Този Урок е използван в следните курсове и занятия.
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