Program Review: Color Sensor Comparison
1_IfElse_Block
Checks whether the Color Sensor value is 'colorGreen'.
If it is, sends program flow to the 'if'(first) branch.
If not, sends program flow to the 'else'(second) branch.
Robot makes a decision based on
whether the Color Sensor sees Green or not.
2_TurnRight_
Turns in place to the right, for 0.7
rotations (approx. 90 degrees) at 50% power.
Turns 90 degrees to the right if the
object in front of the robot is Green.
3_TurnLeft_
Turns in place to the left, for 0.7
rotations (approx. 90 degrees) at 50% power.
Turns 90 degrees to the left if the
object in front of the robot is NOT Green.
Program Review: Tiled Maze
- The program shown below is a sample solution to the
Tile Maze Mini-Challenge
from If/Else 4.
- Note: the sample maze shown in the
Tile Maze Mini-Challenge will appear to require a
left turn, but it can be solved using only right turns! It is slow, but the
robot can figure its way out.
1_Repeat_Block
Conditionally sends the program flow back
to the start of the loop. Lets the flow out of the loop after the
10th pass through the loop.
Robot repeats the movements inside
the loop until they have been run 10 times.
2_IfElse2_Block
Checks whether the Distance Sensor value is less than '500'.
If it is, sends program flow to the 'if'(first) branch.
If not, sends program flow to the 'else'(second) branch.
Robot makes a decision based on
whether there is a maze wall within 50cm.
3_TurnRight_
Turns in place to the right, for 0.7
rotations (approx. 90 degrees) at 50% power.
Turns 90 degrees to the right to avoid
hitting the maze wall.
5_Forward_
Moves the robot forward 1.5 rotations
(approx. 30cm) at 50% power.
The robot drives 30cm forward. This would
be a single 'maze tile'.