- :-

Topics Covered

  • If-Else Block in Loop Block
  • Repeated Decisions
  • Lesson Links

    Check Your Understanding:
    1. 1. What happens when you place an if-else conditional block inside a Repeat Forever Loop?
    2. The robot runs in a circle until told to stop.
      The robot makes a decision once, then repeats the result many times.
      The robot makes a decision many times, taking whatever action is appropriate each time.
      You cannot place an if-else statement block inside a Repeat Forever Loop.
    Try It!
    Try it! 1

    Smarter Maze Solver

    The program shown in the video above is in its simplest form, so the robot's performance is very limited. Change your code to add new, useful features! Try it!

    Enhance your program by adding the following features:

      LED Feedback
      • Output green to the Touch LED any time the robot is moving forward.
      • Output red to the Touch LED any time the robot is turning right

      Limited Duration
      • The robot may get stuck. Make the program end after it has performed 10 moves in total.
    What happens?
    Now you can tell when your robot sees an object/wall by observing the color of its LEDs. Additionally, if the robot gets stuck, it will eventually stop since it is programmed to make 10 moves.
    Mini Challenge

    Mini Challenge 1: Tiled Maze

    The program shown in the video above is in its simplest form, so the robot's performance is very limited. Change your code to add new, useful features!
    • Build a maze for the robot, made up of square floor tiles. (If you don't have floor tiles, use 30 cm squares).
    • Make sure you adjust your rotation to go one tile, not 0.5 rotations.
    • Use folders or boxes to make sure the robot can recognize the walls.

    Note: Though it may not look that way,
    the sample maze shown above CAN be solved using only right turns!
    Not sure how? Give this challenge a try, and see what happens!

    And remember to stay patient for your robot.

    Each time the robot decides that there is NO wall or object in front of it, it will have to travel a distance that is equivalent to one maze tile.

    + hint