Program Review: Move If Clear
            
            
            
            
              - The program shown below is sample code for "Move If Clear" lesson.
              
 
            
            
            
              
              
              
              
              
              
                Switch Block
                Ultrasonic Sensor - Compare - Distance Centimeters
                Checks whether the Ultrasonic sensor value is less than '50'. If it is, sends program flow to the "true" (top) branch.
                If not, sends program flow to the "false" (bottom) branch.
              
                Robot makes a decision based on whether there is an
                obstacle within 50 cm.
              
              
                Move Steering Block
                On for Rotations
                Makes a turn to the right, for 0.5 rotations
               (which causes about 90 degrees of body turn) at 50% power.
                Turn the robot 90 degrees to the right
              
              
                Move Steering Block
                On for Rotations
                Moves the robot forward 3 rotations at 50% power.
                Robot drives forward
              
             
            
            
            
              Program Review: Color Sensor Compare Switch
            
            
            
            
              - The program shown below is sample code for the Color Sensor Compare Switch mini-challenge in the "Move If Clear" lesson.
              
 
            
            
            
              
              
              
              
              
              
                Switch Block
                Color Sensor - Compare - Color
                Checks whether the Color sensor value is one of the selected colors -- '3' (green) or '7' (brown) -- or not. If seeing one of those colors, sends program flow to the "true" (top) branch.
                If not, sends program flow to the "false" (bottom) branch.
              
                Robot makes a decision based on whether it is seeing one of the selected colors or not.
              
              
                Move Steering Block
                On for Rotations
                Makes a turn to the right, for 0.5 rotations
               (which causes about 90 degrees of body turn) at 50% power.
                Turn the robot 90 degrees to the right
              
              
                Move Steering Block
                On for Rotations
                Makes a turn to the left, for 0.5 rotations
            (which causes about 90 degrees of body turn) at 50% power.
                Turn the robot 90 degrees to the left
              
             
            
            
            
              Program Review: Color Name Reader
            
            
            
            
              - The program shown below is sample code for the Color Name Reader mini-challenge in the "Move If Clear" lesson.
              
 
              - 
                For simplicity, this sample code does not show cases for ALL colors. To have more than 4 cases, add new cases by clicking on the small '+' button on the switch block.
              
 
            
            
            
              
              
              
              
              
              
                Switch Block
                Color Sensor - Measure - Color
                Sees what the Color sensor value is, and sends the program flow to the corresponding case. For example, if the sensor sees black, it sends the program flow to the branch marked with the black box.
              If the sensor sees red, it sends the program flow to the branch marked with the red box, etc.
              
                Robot makes decision based on what color it sees.
              
              
                Sound Block
                Play file
                Plays the sound file named
               'Black'.
                Robot says
               'Black!' if it sees the color Black.
              
              
                Sound Block
                Play file
                Plays the sound file named
               'Red'.
                Robot says
               'Red!' if it sees the color Red.
              
              
                Sound Block
                Play file
                Plays the sound file named
               'Yellow'.
                Robot says
               'Yellow!' if it sees the color Yellow.
              
              
                Sound Block
                Play file
                Plays the sound file named
               'Green'.
                Robot says
               'Green!' if it sees the color Green.
              
             
            
            
            
              Program Review: Smarter Decisions Challenge (Advanced Maze Runner)
            
            
            
            
              - The program shown below is sample code for mini-challenge in the "Looped Decision" lesson.
              
 
            
            
            
              
              
              
              
              
                Loop Block
                Loop for count
                Conditionally sends the program flow back to the start of the loop.
            Lets the flow out of loop when loop count is '10'.
                Robot repeats movements inside the loop until it has made 10 repetitions.
              
              
                Switch Block
                Ultrasonic Sensor - Compare - Distance Centimeters
                Checks whether the Ultrasonic sensor value is less than '50'. If it is, sends program flow to the "true" (top) branch.
                If not, sends program flow to the "false" (bottom) branch.
              
                Robot makes a decision based on whether there is an
            obstacle within 20 cm.
              
              
              
                Sound Block
                Play file
                Plays the sound file named 'Right'.
                Robot says "Right!" when there is an obstacle within 20 cm.
              
              
                Move Steering Block
                On for Rotations
                Makes a turn to the right, for 0.5 rotations
               (which causes about 90 degrees of body turn) at 50% power.
                Turn the robot 90 degrees to the right
              
              
                Sound Block
                Play file
                Plays the sound file named 'Forward'.
                Robot says "Forward!" when there is no obstacle within 20 cm.
              
              
                Move Steering Block
                On for Rotations
                Moves the robot forward 3 rotation at 50% power.
                Robot drives forward