In this lesson, we’ll learn about logic, such as if-then statements and loops. You’ll practice with these concepts by coding with the color sensor to create a traffic light robot!
A robot has an if-then block. It says: "If the color sensor detects red, then move forward."What will the robot do if it sees the color blue? It will move forward. It will stop. It will do nothing. It will show an error message. You need your robot to stop and wait until it sees a specific color before it continues with the rest of its program. Which type of loop should you use? The Repeat X Times loop. The Forever loop. The Wait Until loop. The Repeat Until loop. If you want your robot to move in a square shape over and over again, what two types of blocks would be the most important for your program? Wait Until and start moving. Repeat Until and stop moving. Loops and if-then statements. Slower speed and wait. A robot is programmed to move forward repeatedly until the distance sensor detects an object. Which kind of loop is the robot using? Forever Loop. Repeat X Times. Repeat Until. Wait Until. In the Traffic Light Activity, what block tells the robot to check for colors over and over again? The if-then-else block. The forever loop. The start moving forward block. The when program starts block.