ROBOTC for MINDSTORMS - Until Functions  

ROBOTC Natural Language - TETRIX: (PDF) 

Until Functions:
Title Picture Description Default Usage and Sample Usage and Sample with Parameters

Until Touch Until Touch The robot does what it was doing until the touch sensor is pressed in.

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

untilTouch(sensorPort)
default sensor: S2


forward();
untilTouch();
stop();


untilTouch(sensorPort)
To go forward at speed 50 until touch sensor in port S3 is pressed:


forward(50);
untilTouch(S3);
stop();



Until Release Until Release The robot does what it was doing until the touch sensor is released.

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

untilRelease(sensorPort)
default sensor: S2

forward();
untilRelease();
stop();


untilRelease(sensorPort)
To go forward at speed 50 until touch sensor in port S3 is released:

forward(50);
untilRelease(S3);
stop();



Until Bump Until Bump The robot does what it was doing until the touch sensor is pressed in and then released out. A delay time in milliseconds can be specified.

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

Acceptable Range for Delay Time:
0 to 3,600,000.

untilBump(sensorPort, delay)
default sensor: S2
default delay time: 10 milliseconds

forward();
untilBump();
stop();

untilBump(sensorPort, delay)
To go forward at speed 50 until touch sensor in port S3 is pressed and then released with a delay of 100 milliseconds:

forward(50);
untilBump(S3, 100);
stop();


Until Sonar - Greater Than
Until Sonar Greater Than The robot does what it was doing until the sonar sensor reads a value greater than a set distance in centimeters.

Range: 0 to 254 (A value of 255 means it cannot detect anything.)

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

untilSonarGreaterThan(distance, sensorPort)
default distance: 30 centimeters
default sensor: S4


forward();
untilSonarGreaterThan();
stop();

untilSonarGreaterThan(distance, sensorPort)
To go forward at speed 50 until the sonar sensor reads a value greater than 45 centimeters in S2:

forward(50);
untilSonarGreaterThan(45, S2);
stop();


Until Sonar - Less Than
Until Sonar Less Than The robot does what it was doing until the sonar sensor reads a value less than a set distance in centimeters.

Range: 0 to 254 (A value of 255 means it cannot detect anything.)

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

untilSonarLessThan(distance, sensorPort)
default distance: 30 centimeters
default sensor: S2



forward();
untilSonarLessThan();
stop();

untilSonarLessThan(distance, sensorPort)
To go forward at speed 50 until the sonar sensor reads a value less than 45 centimeters in port S2:


forward(50);
untilSonarLessThan(45, S2);
stop();


Until
Sound
- Greater Than
Until Potentiometer Greater Than The robot does what it was doing until the sound sensor reads a value greater than a set threshold level.

Range: (quiet) 0 to 100 (loud)

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

untilSoundGreaterThan(threshold, sensorPort)
default threshold: 50
default sensor: S2


forward();
untilSoundGreaterThan();
stop();

untilSoundGreaterThan(threshold, sensorPort)
To go forward at speed 50 until the potentiometer sensor reads a value greater than 85 on port S3:


forward(50);
untilSoundGreaterThan(85, S3);
stop();


Until
Sound
- Less Than

Until Potentiometer Less Than The robot does what it was doing until the sound sensor reads a value less than a set threshold level.

Range: (quiet) 0 to 100 (loud)

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

untilSoundLessThan(threshold, sensorPort)
default threshold: 50
default sensor: S2



forward();
untilSoundLessThan();
stop();

untilSoundLessThan(threshold, sensorPort)
To go forward at speed 50 until the potentiometer sensor reads a value greater than 15 on port S3:


forward(50);
untilSoundLessThan(15, S3);
stop();


Until Button Press
Until Button Press The robot does what it was doing until a button on the NXT is pressed.

Acceptable Buttons:
centerBtnNXT, rightBtnNXT, leftBtnNXT

untilButtonPress(button)
default button: centerBtnNXT


forward();
untilButtonPress();
stop();

untilButtonPress(button)
To go forward at speed 50 until the right button is pressed on the NXT:


forward(50);
untilButtonPress(rightBtnNXT);
stop();


Until Light
Until Light The robot does what it was doing until the light sensor reads a value lighter than the threshold.

Range: (light) 0 to 100 (dark)

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

untilLight(threshold, sensorPort)
default threshold: 45
default sensor: S3

forward();
untilLight();
stop();

untilLight(threshold, sensorPort)
To go forward at speed 50 until the light sensor reads a value lighter than 75 in port S1:

forward(40);
untilLight(75, S1);
stop();


Until Dark
Until Dark The robot does what it was doing until the light sensor reads a value darker than the threshold.

Range: (light) 0 to 100 (dark)

Acceptable Sensors: sensor ports 2 through 4 (and your names for them given in Motors and Sensors Setup.)

untilDark(threshold, sensorPort)
default threshold: 45
default sensor: S3


forward();
untilDark();
stop();

untilDark(threshold, sensorPort)
To go forward at speed 50 until the light sensor reads a value darker than 75 in port S1:

forward(50);
untilDark(75, S1);
stop();


Until Rotations Until Rotations The robot does what it was doing until the quadrature encoder rotations match the desired value.

Range: 0 to >65000

Acceptable Encoders: motor ports A through K (and your names for them given in Motors and Sensors Setup.)

untilRotations(rotations, motorEncoderPort)
default rotations: 1.0 rotations
default motor encoder: motorB

forward();
untilRotations();
stop();

untilRotations(rotations, motorEncoderPort)
To go forward at speed 50 for 2.75 rotations, keeping track of the rotations on motorA:

forward(50);
untilRotations(2.75, motorA);
stop();


Until Encoder Counts Until Encoder Counts The robot does what it was doing until the encoder counts match the desired value.

Range: 0 to >65000

Acceptable Encoders: motor ports A through K (and your names for them given in Motors and Sensors Setup.)

untilEncoderCounts(counts, motorEncoderPort)
default counts: 360 encoder counts
default motor encoder: motorB


forward();
untilEncoderCounts();
stop();

untilEncoderCounts(counts, motorEncoderPort)
To go forward at speed 50 for 990 encoder counts, keeping track of the encoder counts on motorA:


forward(50);
untilEncoderCounts(990, motorA);
stop();


(print me in landscape mode)

 

 


Copyright © 2012 Robotics Academy/Robomatter - http://robotc.net/