0% found this document useful (0 votes)
17 views3 pages

NL - PIC - Quick

Uploaded by

cfamdisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

NL - PIC - Quick

Uploaded by

cfamdisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ROBOTC Natural Language - VEX PIC Quick Reference:

Set Servo setServo(); setServo(port7, 95);


Set a servo to a desired position.
Default servo and position: port6, 0.

Start Motor startMotor(); startMotor(port8, -32);


Set a specific motor to a speed. wait(); wait(0.5);
Default motor and speed: port6, 95. stopMotor(); stopMotor(port8);

Stop Motor startMotor(); startMotor(port8, -32);


Stop a specific motor. wait(); wait(0.5);
Default motor: port6. stopMotor(); stopMotor(port8);

Wait startMotor(); startMotor(port8, 63);


Wait an amount of time measured in seconds. wait(); wait(2.7);
Only use whole numbers on the VEX PIC. stopMotor(); stopMotor(port8);
Default time: 1.

Wait in Milliseconds startMotor(); startMotor(port8, 63);


Wait an amount of time measured in waitInMilliseconds(); waitInMilliseconds(2700);
milliseconds. stopMotor(); stopMotor(port8);
Default time: 1000.

Until Touch startMotor(); startMotor(port8, 63);


The robot waits for the Touch Sensor to be untilTouch(in10); untilTouch(in10);
pressed. stopMotor(); stopMotor(port8);
Default sensor port: NONE.

Until Release startMotor(); startMotor(port8, 63);


The robot waits for the Touch Sensor to be untilRelease(in10); untilRelease(in10);
released. stopMotor(); stopMotor(port8);
Default sensor port: NONE.

Until Bump startMotor(); startMotor(port8, 63);


The robot waits for the Touch Sensor to be untilBump(in10); untilBump(in10);
pressed in and then released out. stopMotor(); stopMotor(port8);
Default sensor port: NONE.

Until Button Press startMotor(); startMotor(port8, 63);


The robot waits for a button on the VEX LCD to untilButtonPress(); untilButtonPress(rightBtnVEX);
be pressed. stopMotor(); stopMotor(port8);
Default button: centerBtnVEX.

Until Sonar - Less Than startMotor(); startMotor(port8, 63);


The robot waits for the Sonar Sensor to read a untilSonarLessThan(45, untilSonarLessThan(45, in2);
value in cm less than the threshold. in2); stopMotor(port8);
Default threshold and sensor port: NONE. stopMotor();

Until Sonar - Greater Than startMotor(); startMotor(port8, 63);


The robot waits for the Sonar Sensor to read a untilSonarGreaterThan(45, untilSonarGreaterThan(45, in2);
value in cm greater than the threshold. in2); stopMotor(port8);
Default threshold and sensor port: NONE. stopMotor();

© 2010 Carnegie Mellon Robotics Academy / For use with VEX Robotics Systems ROBOTC Natural Language - VEX PIC Quick Guide • 1
ROBOTC Natural Language - VEX PIC Quick Reference:

Until Potentiometer - Greater Than startMotor(); startMotor(port8, 63);


The robot waits for the Potentiometer Sensor untilPotentiometerGreaterThan( untilSonarGreaterThan(900, in4);
to read a value greater than a set position. 900, in4); stopMotor(port8);
Default threshold and sensor port: NONE. stopMotor();

Until Potentiometer - Less Than startMotor(); startMotor(port8, 63);


The robot waits for the Potentiometer Sensor untilPotentiometerLessThan( untilSonarLessThan(40, in4);
to read a value less than a set position. 500, in4); stopMotor(port8);
Default threshold and sensor port: NONE. stopMotor();

Until Dark startMotor(); startMotor(port8, 63);


The robot waits for the Light Sensor to read a untilDark(400, in4); untilDark(400, in4);
value greater than the threshold. stopMotor(); stopMotor(port8);
Default threshold and sensor port: NONE.

Until Light startMotor(); startMotor(port8, 63);


The robot waits for the Light Sensor to read a untilLight(400 in4); untilLight(400, in4);
value less than the threshold. stopMotor(); stopMotor(port8);
Default threshold and sensor port: NONE.

Until Rotations startMotor(); startMotor(port8, 63);


The robot waits for an encoder to reach a untilRotations(2, in3); untilRotations(2, in3);
specified whole number of rotations. stopMotor(); stopMotor(port8);
Default rotations, encoder: NONE

Until Encoder Counts startMotor(); startMotor(port8, 63);


The robot waits for an encoder to reach a untilEncoderCounts(990, untilEncoderCounts(990, in3);
specified number of encoder counts. in3); stopMotor(port8);
Default counts, encoder: NONE. stopMotor();

LED ON turnLEDOn(); turnLEDOn(dgtl7);


Turn an LED in a specified digital port ON. wait(); wait(0.5);
Default sensor port: in12. turnLEDOff(); turnLEDOff(dgtl7);

LED OFF turnLEDOn(); turnLEDOn(dgtl7);


Turn an LED in a specified digital port OFF. wait(); wait(0.5);
Default sensor port: in12. turnLEDOff(); turnLEDOff(dgtl7);

Flashlight ON turnFlashlightOn(); turnFlashlightOn(port10, 127);


Turn a VEX Flashlight in a specified motor port wait(); wait(0.5);
ON at a specified brightness. turnFlashlightOff(); turnFlashlightOff(port10);
Default motor port and brightness: port4, 63.

Flashlight OFF turnFlashlightOn(); turnFlashlightOn(port10, 127);


Turn a VEX Flashlight in a specified motor port wait(); wait(0.5);
OFF. turnFlashlightOff(); turnFlashlightOff(port10);
Default motor port: port4.

Robot Type robotType(); robotType(squarebot);


Choose which robot you are using (Recbot or
Swervebot).
Default bot: none.

© 2010 Carnegie Mellon Robotics Academy / For use with VEX Robotics Systems ROBOTC Natural Language - VEX PIC Quick Guide • 2
ROBOTC Natural Language - VEX PIC Quick Reference:

Forward forward(); forward(63);


The robot drives straight forward. wait(); wait(2.0);
Default speed: 95. stop(); stop();

Backward backward(); backward(63);


The robot drives straight backward. wait(); wait(2.0);
Default speed: -95. stop(); stop();

Point Turn pointTurn(); pointTurn(left, 63);


The robot makes a sharp turn in place. wait(); wait(0.4);
Default direction and speed: right, 95. stop(); stop();

Swing Turn swingTurn(); swingTurn(left, 63);


The robot makes a wide turn, activating only wait(); wait(0.75);
one drive motor. stop(); stop();
Default direction and speed: right, 95.

Stop forward(); forward(63);


The robot halts both driving motors, coming to wait(); wait(2.0);
a stop. stop(); stop();

Move Straight - for Time moveStraightForTime(7, moveStraightForTime(7, in5, in3);


The robot will use encoders to maintain a in5, in3); stop();
straight path for a specified time in seconds. stop();
Default rotations, rightEncoder, leftEncoder: 5, in2, in3 + interrupts.

Move Straight - for Rotations moveStraightForRotations( moveStraightForRotations(4, in5, in3);


The robot will use encoders to maintain a straight 4, in5, in3); stop();
path for a specified distance in encoder rotations. stop();
Default rotations, rightEncoder, leftEncoder: 1, in2, in3 + interrupts.

Tank Control while(true) while(true)


The robot is remote controlled with the right motor mapped to { {
the right joystick and the left motor mapped to the left joystick. tankControl(); tankControl(Ch1, Ch4);
Default right and left and joystick: Ch2, Ch3. } }

Arcade Control while(true) while(true)


The robot is remote controlled with both { {
motors mapped to a single joystick. arcadeControl(); arcadeControl(Ch1, Ch4);
Default vertical and horizontal joysticks: Ch2, Ch1. } }

© 2010 Carnegie Mellon Robotics Academy / For use with VEX Robotics Systems ROBOTC Natural Language - VEX PIC Quick Guide • 3

You might also like