Motor and Sensor Setup

Robot C is the programming language used to program the VEX IQ platform. This lesson will go over how to use the Robot C environment

Before you get started, make sure you know what kind of program you would like to create there are two options

  • Autonomous -the robot is able to function and move by itself. This can be either through the use of “dead reckoning”, position based movement, or any sensors that the robot uses.
  • Remote Controlled also known as Tele-op on the selection menu

To select the program type, click on the “Robot” tab, VEX IQ Controller Mode,  and select the appropriate program type.

The following buttons are the portion of the GUI that will help you navigate and familiarize yourself with the RobotC programming environment

  1. This is the new file button, this will generate new blank sketches for your code.
  2. This is the file save button, this will save the currently opened program. Remember to save periodically, you do not want to lose your code.
  3. This is the firmware download button, this will download the original program to the board. This is very useful if you are ever experiencing problems with your robot.

4. The debugger window, will display any and all errors on your code. Make sure you check this window after you have compiled your code, most errors are due to incorrect syntax. After a while this should get easier for you!

5.  This is the fix formatting button, it will auto format all of your code for you. This is especially helpful when your code gets longer.

6. This is the Motor and Sensor Setup button, this is how you add motors and sensors into your program. The pictures below will go over this in more detail.

7.  This is the Compile Program button, this is like a spell checker for code. Once you are done writing your code, this is something you want to press after you have completed your program. Any and all errors will be displayed in the Debugger window, as well as some marks will appear on the side of your code.

8.  This is the Download to Robot button, press this button to download your code to your robot. Make sure your robot is plugged in before pressing this!

This is how to set up your motors.

Under the “Port” heading, this will correspond to the port that the motor is connected to. Find the corresponding port on your robot and in the next field under “Name” you can name your motor. Tip: Make sure that you name your motor something descriptive, that way it will be easier for you to differentiate what your motor is called later on.

Lastly, under type, make sure that you change “No motor” to “VEX IQ MOTOR”.

After you select a motor type you can also reverse a motor. This is done by clicking the checkbox under “Reversed”. This will change the convention from positive numbers making the motor spin clockwise, to positive numbers making the motor spin counter clockwise.

This tab is if you want to add sensors into your robot program.

This features all the same major headings. Under sensor type you will have to declare which sensor you are using.

Activity

Set up your code so it can work with your robot. Add the appropriate number of motors and sensors to your robot!

Tip: Remember you will have to do this for any and all codes that you create, make sure that you name your file something easily recognizable and also make sure that you save it in the appropriate location so that you can find it next time!