User’s Guide
Parameter1 and Parameter2 are the objects to be compared, and the operator
decides what type of comparing will to be performed. For example, for a sentence
“If A is larger than B,” “A” is paramter1, “B” is parameter2, and “larger” is
the operator.
Let’s say that there is a traffic signal made of red, orange, and green lights. We
want to make a robot that stops at red, gets ready at orange, and moves at
green. A program using the IF commands would look like the following.
IF signal = red THEN, robot stops.
IF signal = orange THEN, robot gets ready.
IF signal = green THEN, robot moves.
ELSE IF, ELSE
In the program above, the robot has to check all three color conditions. However,
if the signal is red, the robot does not need to check whether the lights are
orange or green. If the signal is orange, the robot does not have to check
whether the lights are red or green. Using the ELSE IF and the ELSE command, we
can simplify the program by eliminating this need for checking all three conditions.
IF signal = red THEN, robot stops.
ELSE IF signal = orange THEN, robot gets ready.
ELSE robot goes.
CONT IF
If you want to change the behavior control program above to implement “If the
signal is red, or if a car is coming, then stop the robot” you can do so using the
CONT IF command. What would happen if we create a program as the following?
IF, signal = red AND
ELSE IF, car is coming THEN, stop robot.
The program above tells the robot to stop only when the signal is red and at the
same time if a car is coming. For the command AND, the lines after THEN will be
executed only when both statements are true. In order for the program to work
properly, it has to be changed as the following.
IF, signal = red OR
ELSE IF, car is coming THEN, stop robot.
51
Summary of Contents for Robotis
Page 1: ...Ver 1 00 BIOLOID User s Guide Closer to Real...
Page 55: ...User s Guide Portion that will be ignored Enable Disable Code Portions that will be ignored 55...
Page 73: ...User s Guide Move routine Stop Backward Left turn Right turn Melody sound routine 73...
Page 100: ...User s Guide Transmitter behavior control program Receiver behavior control program 100...