Sample VEX IQ Code
I get a lot of questions about to to program VEX IQ using RobotC.
- How do we make the arm move to a specific location?
- Can we use the same program for Autonomous and Driver Command?
- We have a list of commands that execute when we press a button. Sometimes the robot will get stuck, while executing the commands. How do we make it stop?
Below are three code samples. They are intentionally posted as images in order to allow you the joy of typing each character, and learning something in the process.
The first code shows how to make a motor move to a specific location, using RUp and RDown (lines 11-19).
It also shows how to call the same block of code using the remote control OR touch LED (lines 20-37)
This image simply shows the above program converted to text using RobotC's "Convert Graphic File to Text" command.
This code demonstrates the use of tasks, for running code that can be interrupted at any time.