- :-

Topics Covered

  • MoveMotor Command Block
  • Lesson Links

    Check Your Understanding:
    1. 1. What does the moveMotor command block do?
    2. Move the robot forward or backward as specified
      Run a single motor in the way the command specifies
      Move a motor to a different port on the robot
      Set the motor to movement mode
    3. 2. What happens when you use a negative speed value?
    4. The command works the same as if you had a positive value
      The robot can't go slower than 0, so it just stays still
      Motor runs backwards
      The command does not work and gives error
    5. 3. What happens when you put more than one command in a program?
    6. Only the first one runs
      They run in order, according to their line numbers
      All commands run at once
      Only one command can be added at a time
    Try It!
    Try it! 1

    LED Feedback

    It can be hard to tell which part of your program the robot is running when your programs have multiple steps.

    Add the setTouchLEDColor command to these spots in your program with different colors to visually see how your robot is running your program. Try it!

    What happens?
    The program runs in sequential order, from top to bottom. Depending on where setTouchLEDColor is placed, the Touch LED can react to how the arm motor moves.
    Did You Know?

    Did you know?

    The arm motor needs to turn 315 degrees to move the arm between the up and down positions, but the arm itself does not move 315 degrees.
    • This is because the gears that connect the motor to the arm are not the same size.
    • The gear on the motor is very small compared to the gear that is actually attached to the arm. The smaller gear will need to turn many times in order to turn the larger gear around even once.
    • However, this configuration also provides the motor with "mechanical advantage", trading more rotations for more strength as it turns. This allows the motor to keep the arm under control even when the robot is holding something that makes the arm heavy.

    Did you know?

    How to Avoid Claw Motor Getting Stuck

    When controlling the Claw motor with the moveMotor command block,
    you should consider using seconds (or milliseconds) as the unit type. By choosing timing,
    you will prevent a scenario where the moveMotor command block cannot complete its movement
    and halts the program flow.

    Consider this scenario: The VEX IQ claw is already opened to its max position.

    The robot must finish 2 rotations of rotation on the claw no matter what, even if the claw cannot be opened any farther!

    When this happens, your robot will be stuck on the moveMotor block forever. To stop the robot, simply terminate the program.
    If "2 seconds" is used as the stopping condition, the robot will still try to open the claw farther, but this time, the robot will try it only for 2 seconds.

    After 2 seconds, the robot will give up, and the program moves onto the next command block.
    Mini Challenge

    Mini Challenge 2: Gripper Control

    Program your robot to travel to the object, lower it’s arm, and grab it with the gripper. The gripper "hand" motor is on Port 11 on your robot.
    • Use a cylindrical prop that the robot can easily fit around and grip.
    • Start with the robot's arm in the 'up' position and the claws wide open.

    You will need the robot to lower its arm and close its gripper, in that order.

    It takes a small amount of degrees to close the gripper on the object.

    + hint
    Mini Challenge

    Mini Challenge 3: Cargo Transport

    Program your robot to pick up the object in front of it, then carry it 85 cm, drop the object, and back up to its starting point.
    • Place two pieces of tape so they are 85 cm apart from each other.
    • Place your robot so that the front wheels are on the tape, and the cylindrical prop in front of it
    • Start with arm in the 'down' position and claws open wide

    Try writing down the actions the robot will need to perform, in the order that they need to occur. Then add commands to the program for the robot to do those things in the same order..

    Don't try to close the gripper for a set number of rotations. If the gripper can't close any tighter, it will get stuck and never complete the command. Use time instead so it squeezes for a set amount of time, then remains closed in place.

    + hint