Programming instructions
ROBOTC Natural Language - Cortex Quick Reference:
ROBOTC Natural Language - Cortex Quick Guide • 1
©
2010 Carnegie Mellon Robotics Academy / For use with VEX Robotics Systems
Set Servo
Set a servo to a desired position.
Default servo and position: port6, 0.
setServo(); setServo(port7, 95);
Start Motor
Set a specic motor to a speed.
Default motor and speed: port6, 95.
startMotor();
wait();
stopMotor();
startMotor(port8, -32);
wait(0.5);
stopMotor(port8);
Stop Motor
Stop a specic motor.
Default motor: port6.
startMotor();
wait();
stopMotor();
startMotor(port8, -32);
wait(0.5);
stopMotor(port8);
Wait
Wait an amount of time measured in seconds.
Default time: 1.0.
startMotor();
wait();
stop();
startMotor(port8, 63);
wait(2.7);
stop();
Wait in Milliseconds
Wait an amount of time measured in
milliseconds.
Default time: 1000.
startMotor();
waitInMilliseconds();
stop();
startMotor(port8, 63);
waitInMilliseconds(2700);
stop();
Until Touch
The robot waits for the Touch Sensor to be
pressed.
Default sensor port: dgtl6.
startMotor();
untilTouch();
stop();
startMotor(port8, 63);
untilTouch(dgtl10);
stop();
Until Release
The robot waits for the Touch Sensor to be
released.
Default sensor port: dgtl6.
startMotor();
untilRelease();
stop();
startMotor(port8, 63);
untilRelease(dgtl10);
stop();
Until Bump
The robot waits for the Touch Sensor to be
pressed in and then released out.
Default sensor port: dgtl6.
startMotor();
untilBump();
stop();
startMotor(port8, 63);
untilBump(dgtl10);
stop();
Until Button Press
The robot waits for a button on the VEX LCD
to
be pressed.
startMotor();
untilButtonPress();
stop();
startMotor(port8, 63);
untilButtonPress(rightBtnVEX);
stop();
Until Sonar - Less Than
The robot waits for the Sonar Sensor to read a
value in cm less than the threshold.
Default threshold and sensor port: 30, dgtl8+9.
startMotor();
untilSonarLessThan();
stop();
startMotor(port8, 63);
untilSonarLessThan(45, dgtl2);
stop();
Until Sonar - Greater Than
The robot waits for the Sonar Sensor to read a
value in cm greater than the threshold.
Default threshold and sensor port: 30, dgtl8+9.
startMotor();
untilSonarGreaterThan();
stop();
startMotor(port8, 63);
untilSonarGreaterThan(45, dgtl2);
stop();
Go to Reference Links