- :-

Topics Covered

  • setMultipleMotors Command Block
  • stopMultipleMotors Command Block
  • waitUntil Command Block
  • Lesson Links

    Check Your Understanding:
    1. 1. What does the setMultipleMotors command block allow you to do?
    2. Turn up to 4 motors on at a specific power
      Turn up to 4 motors on for a certain number of rotations
      Turn up to 4 motors on until the Touch Sensor is triggered
      Combines with the next block to make a special command
    3. 2. What does the stopMultipleMotors command block allow you to do?
    4. Turn up to 4 motors off
      Wait for the Touch Sensor to be pressed
      Wait for the Touch Sensor to be pressed, then turn the motors off
      End the program
    5. 3. What does the waitUntil command block allow you to do?
    6. Force the robot to stop until what the command is set to wait for has happened
      Allow the robot to keep doing what it was doing until what the command is set to wait for has happened
      Wait for an until command block to be processed before moving on
      waitUntil is not a valid name for a command
    Try It!
    Try it! 1

    Color Bumper

    The Touch LED Sensor is also considered a touch sensor, but can use to identify which part of the program is running by lighting up different colors.

    Add two setTouchLEDColor command blocks to the program, one before and one right after the waitUntil command block.

    • Set the first setTouchLEDColor to 'touchLED' and 'colorRed'
    • Set the second setTouchLEDColor to 'touchLED' and 'colorGreen'

    Try it!

    What happens?
    The Touch LED starts red, then changes to green when the bumper switch is pressed.
    Try it! 2

    Already Pressed

    What happens if you’re already pressing in the Bumper Switch when you start running the program? Try it!
    What happens?

    The robot doesn’t move at all. The waitUntil block detects that the sensor is “Pressed” and the motors are stopped before you can observe then moving.

    "Pressed” simply means “the button is in the pressed position”; it does not matter how or when it was pressed in!

    Try it! 3

    Forward Until Release

    Set the compare-to value on the waitUntil command to 0, and place a box against the sensor by. Try it!

    • For Virtual Robots, choose 'Point B' as the starting point.

    What happens?

    The waitUntil control block can wait for the sensor to be “Released” as well as “Pressed”. The robot moves forward until the Touch Sensor is “Released”, then stops.

    Mini Challenge

    Mini Challenge 1: Vacuum

    Program the robot to touch all four walls of a room, using its Bumper Switch to know when it has touched each one.

    Start with the robot's arm in the 'up' position to expose the bumper switch.

    The robot can also back away from a wall to avoid getting stuck.

    Adjacent walls are just a 90-degree turn away from each other.

    + hint
    Did You Know?

    Did you know?

    How Bumper Sensor Works
    When the Touch Sensor is pressed, it closes an electrical circuit, allowing current to flow.
    If the Bumper Switch is released, the circuit is broken and no current flows.

    The flow (or lack) of current is detected by the VEX IQ, allowing it to determine the Bumper Switch is pressed.

    Did you know?

    Boolean Logic: Truth Values
    Robots need to know, very clearly, which choice to make under what circumstances. As a consequence, their decisions are always based on the answers to questions which have only two possible answers: yes or no, true or false.


    Statements that can be only true or false are called Boolean statements,
    and their true-or-false value is called a truth value.

    Here are some examples of Boolean Statements Robots can answer!

    Boolean Statement 1: The sky is blue.

    Boolean Statement 2: It snows during summer.

    Loops and If-Else conditional statements in ROBOTC are always Boolean statements!
    They are always either true or false at any given moment.

    Robot C Boolean Statement 1:
    Value from the Distance Sensor is (currently) less than 200.

    Because the current value is 496
    (NOT less than 200).

    Robot C Boolean Statement 2:
    Value from the Distance Sensor is (currently) less than 200.

    Because the current value is 84
    (less than 200).

    Did you know?

    Boolean Logic: Comparison Operators

    Comparisons (such as the comparison of the Ultrasonic sensor’s value against the number 200)
    are at the core of the decision-making process.
    Here are some of the most common ones recognized by ROBOTC.
    ROBOTC Symbol Meaning Sample comparison Result
    "is equal to" 50 == 50
    50 == 100
    100 == 50
    "is not equal to" 50 != 50
    50 != 100
    100 != 50
    "is less than" 50 < 50
    50 < 100
    100 < 50
    "is less than or equal to" 50 <= 50
    50 <= 100
    100 <= 50
    "is greater than" 50 > 50
    50 > 100
    100 > 50
    "is greater than or equal to" 50 >= 50
    50 >= 100
    100 >= 50