Control#
Introduction#
The orange Control cards control the flow of the project and allow the 123 Robot to make decisions. An if card checks a condition, and the cards under it run if the condition is met. The else card runs the cards under it if the condition is not met, and the end if card ends a sequence of if and else cards.
Below is a list of available cards:
if object – Checks if an object is detected directly in front of the robot.
if no object – Checks if an object is not detected directly in front of the robot.
if red – Checks if the color red is detected.
if green – Checks if the color green is detected.
if blue – Checks if the color blue is detected.
if bright – Checks if bright ambient light or a bright object is detected.
if dark – Checks if no ambient light or a dark object is detected.
if right button – Checks if the right button is pressed on the robot.
if left button – Checks if the left button is pressed on the robot.
if move button – Checks if the move button is pressed on the robot.
if sound button – Checks if the sound button is pressed on the robot.
if crash – Checks if the robot detects a crash.
else – Runs the cards under it if the condition of the if card is not met.
end if – Ends a sequence of if and else cards so the project can continue.
if object#
The if object card uses the Eye Sensor to check if an object is detected directly in front of the 123 Robot. An object needs to be approximately 18 mm from the Eye Sensor to be detected.
Example
If an object is in front of the robot, honk. If not, drive forward 1 step.
if no object#
The if no object card uses the Eye Sensor to check if an object is not detected directly in front of the 123 Robot.
Example
If nothing is in front of the robot, drive forward 2 steps.
if red#
The if red card uses the Eye Sensor to check if the color red is detected. Red is a hue from 340° to 20°.
For more detailed information about how the 123 Robot’s Eye Sensor detects colors, see Using the Classroom App to Troubleshoot your 123 Robot.
Example
Drive up to an object. If the object is red, turn left.
if green#
The if green card uses the Eye Sensor to check if the color green is detected. Green is a hue from 80° to 145°.
For more detailed information about how the 123 Robot’s Eye Sensor detects colors, see Using the Classroom App to Troubleshoot your 123 Robot.
Example
Drive up to an object. If the object is green, glow green.
if blue#
The if blue card uses the Eye Sensor to check if the color blue is detected. Blue is a hue from 160° to 250°.
For more detailed information about how the 123 Robot’s Eye Sensor detects colors, see Using the Classroom App to Troubleshoot your 123 Robot.
Example
Drive up to an object. If the object is blue, act happy.
if bright#
The if bright card uses the Eye Sensor to check if bright ambient light or a bright object is detected. The object in front of the Eye Sensor needs to reflect at least 70% of the light to be bright.
Example
If the robot detects something bright, glow green. If not, glow purple.
if dark#
The if dark card uses the Eye Sensor to check if no ambient light or a dark object is detected. If the object in front of the Eye Sensor reflects less than 70% of the light, it is dark.
Example
If the robot detects something dark, glow blue.
if crash#
The if crash card checks if the 123 Robot detects a crash.
Example
Drive forward 1 step. If the robot ran into an object, play the crash sound.
else#
The else card is used together with an if card. The else card will run the cards under it if the condition of the if card is not met.
Example
Drive up to an object. If the object is red, turn left. If not, turn right.
end if#
The end if card ends a sequence of if and else cards. Use it to continue the project after the decision is made. The cards after the end if card run whether or not the condition of the if card was met.
Example
If an object is in front of the robot, turn right to face away from it. Then, drive forward 1 step either way.