In the RobotC software we could make the robot wait for a couple of seconds by using the wait function. This will give the motors a chance to work and this will actually move the robot.
- #328
- 02 Mar 2017
- 1:58
Wait functions
Between line 8 and 9 we add the function "wait1Msec". This means "wait for 1 millisecond" and by setting the parameter to 1000 we will wait 1 millisecond a 1000 times.
English
Currently the program that's running on the robot is just setting motor 2 to power 50 and motor 3 to power of 50. And it's ending. And to make the robot move we must use a wait function. So, let's look at the wait functions.
This here is the program and in this program at the end between the line 8 and 9 we add the function 'wait1Msec'. Now, it's a strange name. We know, we don't like this kind of naming. But let's continue with this. It's a strange name 'wait1Msec'. Well, it's strange because in all the other programming languages, most of them is just a function called 'wait'. But here we have it as 'wait1Msec'. So 'wait1Msec' 1000. This means wait one milliseconds 1000 times. Which is wait for 1000 milliseconds. Which is actually 1 second. And we wait for 1 second. Download and run our program.
Downloading... And the robot moves for about a second. Again. Actually for 1000 milliseconds.
You have your first robot moving. Download, run the program, experiment, try to accomplish the tasks and move it forward for a different number of seconds. Just experiment with the different wait functions.
Курсове и занятия включващи този Урок
Този Урок е използван в следните курсове и занятия.
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 your VEX robot forward/backward
Let's move with the VEX EDR robot using its motors, the wheels and some RobotC programming. We devide the program in three parts - Connect the motors, program the controller and turning.
- 7
- 0
- 0
- 3d_rotation 0