Recent Comments


ROBOTC is the premiere robotics programming language for educational robotics and competitions. ROBOTC is a C-based programming language with an easy-to-use development environment. Use the Moving Forward sample program below to quickly get your robot moving!

Download software:

Cost: 30 day trial; licenses start at $49

Instructions to setup software: Getting Started ROBOTC Wiki Guide

Requirements: PC

Operating systems supported: Windows XP Professional or Home Edition with SP 2 or greater

Difficulty level: 3 out of 5


1. Before downloading a program to a VEX Cortex, make sure to set up the Cortex using the ‘Getting Started with a VEX Cortex (Wired)’ guide on the ROBOTC wiki.

2. Open the ROBOTC program by clicking on its icon.

3. Navigate to the ‘File -> Open Sample Program’ file menu.

4. Double click on the ‘Basic Movement’ folder.

5. Double click on the ‘Moving Forward.c’ program to open it in ROBOTC.

6. With the Cortex connected to the computer, click on the ‘Robot -> Compile and Download’ menu option to download the program to the Cortex.

7. Finally, either click the ‘Start’ button on the program debugger window that appears or unplug the Cortex and power cycle it (turn it off, then turn it back on) to run the program. Your robot should wait for 2 seconds, then move forward for 3 seconds, then stop.


1. ROBOTC programs are read by the compiler from the top to the bottom, left to right (just like reading a book).

2. The first two lines tell ROBOTC that there are motors plugged into motor ports 2 and 3 on the Cortex, and it gives the motor on port 2 the name of ‘rightMotor’, and the motor on port 3 the name of ‘leftMotor’. We can then use these names in the program to tell ROBOTC which motor we want to control.

3. Lines 3 to 26 are comments and are simply notes that the programmer can use to let others know what each line or segment of code does. This helps readability and allows others to understand the code, even if they were not the original authors of the program. Note that the // can be used to comment a single line of text, allowing comments to be placed right next to other lines of code.

4. Line 27 contains the ‘task main()’ declaration that is needed in every ROBOTC program; this tells ROBOTC where to start ‘reading’ code.

5. Lines 28 and 35 are curly braces, which tells ROBOTC where the code starts (line 28, with the { ), and where the code stops (line 35, with the } ).

6. Line 29’s ‘wait1Msec’ command tells ROBOTC to ‘keep doing what you were doing for 2000 milliseconds’, which can be converted to 2 seconds (2000 ms = 2 s). Since ROBOTC isn’t doing anything before the ‘wait1Msec’ command, this line tells ROBOTC to ‘do nothing for 2 seconds’.

7. Line 32 turns on the right motor with a power level of +127 (full power forward) and Line 33 turns on the left motor with a power level of +127 (full power forward). Both of these commands happen one after another and essentially happen at the same time.

8. Line 34 is another ‘wait1Msec’ command, which tells ROBOTC to ‘keep doing what you were doing for 3000 milliseconds’ (3 seconds). Since both motors are turned on, this line tells ROBOTC to ‘keep both motors moving forward at power level +127 for 3 seconds’.

9. Line 35 is a closing curly brace ‘}’, which tells ROBOTC to turn off the motors and stop the program. It stops all of the code that is in between the opening curly brace ‘{’ on Line 28.


1. Change the amount of time the robot waits at the start of the program from 2 seconds to 1.5 seconds. How will this affect how far the robot moves?

2. Make the robot move at half power instead of full power. How far does the robot move compared to full power?

3. What happens when you give the robot a zero power level? What about a negative power level?

4. How would you make the robot turn in place, instead of moving forward?

5. Can you make the robot move forward, stop, then back up to its original location?


VEX Cortex Video Trainer — A video walkthrough on setting up and programming a Cortex with ROBOTC.

ROBOTC wiki -– The official ROBOTC wiki, containing information on all things ROBOTC.

ROBOTC Forums — The place to discuss ROBOTC code with the knowledgeable ROBOTC community.

1 Comment on ROBOTC

  1. I used this program in an Automation and Robotics class in my school. It was fun, but getting all the equipment seemed to much for getting it at home. 🙁

Leave a Comment

Please don't use your real name.