- :-

Topics Covered

  • Loop with Sensor Control
  • Lesson Links

    Check Your Understanding:
    1. 1. When the Loop is set to use the distance sensor as shown below,

      what "condition" will cause it to let Program Flow pass (instead of sending it in)?
    2. The touch sensor is in a pressed state when the robot starts running the program.
      There is no object in front of the robot.
      An object placed 341 mm away from the Distance Sensor.
      An object placed 56 mm away from the Distance Sensor.
    3. 2. What is the correct type of Repeat Loop to use if you want it to be controlled by a sensor?
    4. A repeat(forever) Block
      A repeat Block
      A repeatUntil Block
      Any Repeat Block types will work
    5. 3. When does a repeatUntil Loop check the sensor?
    6. Continuously while inside the Loop
      At the beginning and end of the Loop only
      At the end of the Loop only
      At the end of every block within the Loop
    Try It!
    Try it! 1

    Repeat Until Touch Sensor

    Set the Loop's mode to Touch Sensor instead of Distance Sensor. Make sure the arm is raised on the robot.

    Run the program and try to get the robot to stop! Try it!

    What happens?
    The robot will check the Touch Sensor instead of the Distance Sensor at the beginning of the Loop to see whether it will send Flow in or leave the Loop.

    If the Touch Sensor is being pressed in at the time the Loop begins, the robot will stop! If not, it will move forward and backward as intended until the Touch Sensor is pressed.