- :-

Topics Covered

  • Loop with Count Control
  • Lesson Links

    Check Your Understanding:
    1. 1. A Repeat Loop block will send the Program Flow back…
    2. Every time, forever.
      Only a limited number of times
      If the Touch Sensor is not pressed when the Flow reaches the end of the Loop
      If there is nothing after the Loop
    3. 2. What does it mean for a Loop to be "Conditional?
    4. It only sends the Flow back under certain conditions
      The entire Loop can be skipped under certain conditions
      The Loop runs faster after it is trained, or "conditioned"
      The code runs every time, no matter what
    5. 2. What is the "condition" in this Loop based on?
    6. The distance the robot has traveled
      The value of the Touch Sensor
      The number of times the Loop has sent the Flow back
      The number of seconds the Loop has been running
    Try It!
    Try it! 1

    Changing Loop Count

    Try changing the number in the Loop's Count setting to 2, then running the program. Try it!
    What happens?
    The robot moves forward then back, twice, then stops.
    Mini Challenge

    Mini Challenge 1: Square Dance 2

    In reality, humans may not always be present to stop the robot from moving forever and ever.

    Continue from the mini-challenge you completed from the previous lesson to to fix the program so that the robot stops moving after completing a lap.
    • Use the same setting used in Square Dance 1 from the previous lesson ("Looped Movement").
    • Modify your Challenge program from the Square Dance 1 so that the robot stops after completing exactly one lap around the box.
    • Note : Do not write each movement by hand – use a Loop!

    In the previous lesson, what set of movements was repeated to create an infinite square lap.

    A set of the following movements were looped in infinite to create square laps: 1) move forward 2) make a left/right turn.

    Think about how many of those set of movements are needed to make just a single square lap.

    + hint