To prepare the robot to move in a square and to use a loop in the program we would first make this VEX EDR robot move forward and turn, using a program developed with RobotC.
- 11 Apr 2017
The program for move forward is developed in previous videos. Turn both motors on by setting a power of 50 and use the wait1Msec() call to make the robot wait for about a second.
To turn with a VEX EDR robot set one of the motor's power to 0 and the other to 50. This will stop the first motor and start the other. Again wait for about a second. The code fragment is:
motor[port2] = 0;
motor[port3] = 50;
and it should be enough to make the robot move and turn.
First, we'll make the robot move forward and turn. And after that we'll repeat this 4 times. But let's first make it move and turn.
Initially we start with the program for moving forward and after we move forward we must turn. So, I'll copy this code and then I'll change the value. And I would like to turn with motor connected on port 2 and that's why I'll set the right motor to power 0. And then I'll change so that I can have it on the camera recorded. I'll change the waiting here to half a second. 500 milliseconds and here to about 1 second and a half. So, that's the program and in this program we have the code for move forward and this is moving forward and this is turning and this will turn right. And that's the program for moving and turning.
Lessons with this tutorial
This tutorial is used in the following lessons
- Move and turn. Prepare for implementing a square