- :-

Topics Covered

  • The moveMotor Command
  • 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 an 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 setLEDColor 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 setLEDColor is placed, the LED can react to how the arm motor moves.
    Mini Challenge

    Mini Challenge 1: Cargo Retrieval

    Program your robot to:

    • Raise its arm (Will begin in the up position in RVW)
    • Move 50cm to the box
    • Drop the arm down
    • Back up to robot's starting position with the box

    Place two pieces of black electrical tape 50 cm apart.
    Your robot should travel to the box and bring it back to the starting line.

    Remember to raise the arm before moving the robot forward.

    Line up the box for the robot to use its arm around it.

    Use some fine-tune commands (i.e. pausing after stopping, moving slower)

    Pause for a couple of seconds after commands for consistency.

    + hint
    Did You Notice?

    Did you notice?

    Getting the Program Stuck

    What happens if a line of code cannot complete its action?

     

     

     

     

    Try running you program with its arm already in the "up" position.

    Watch carefully so you can answer the following questions.

     

     

     

     

     

    1. 4. Does the program ever end?
    2. The program keeps running
      The program ends immediately
    3. 5. Does the second line of code ever get to run?
    4. The second line of code never runs
      The second line of code is skipped over
    5. 6. What happens if a line cannot complete its action?
    6. The program will immediately skip to the next line
      The program will try for a while, then display an error and quit
      The program will try for a while, then skip the "stuck" line and move on to the remaining commands
      The program will get "stuck" trying to complete the action, the green light on the robot will flash, and later lines will never be run.