- :-

Topics Covered

  • SetMotorSpeed Command
  • Sleep Command
  • Lesson Links

    Check Your Understanding:
    1. 1. True / False: The setMotorSpeed command uses two parameters. One parameter identifies the motor
      that is being used, and the other parameter identifies the motor power.
    2. True
      False
    3. 2. The sleep command programs the robot to do which of the following?
    4. Wait for a set period of time in milliseconds
      Wait for a set period of time in seconds
      Update the firmware
      Download the program
    5. 3. Setting the setMotorSpeed command for both motors to zero power will result in which of the following?
    6. The robot moving backwards
      The robot stopping
      The robot dancing
      The robot moving forward
    Try It!
    Try it! 1

    Invisible Stop

    Copy and paste the following code into a new program and run it:

    task main()
    {
    setMotorSpeed(leftMotor, 50);
    setMotorSpeed(rightMotor, 50);
    }

    Did the robot move?

    Try it!
    What Happens?

    The Robot’s Central Processor is able to process tens of thousands of commands per second.

    This program will turn on both motors (2 commands), but since there are no other commands to process, the program reaches the end and activates the built-in safety command to shut down all of the motors.

    The result is that the robot will not move since it will have processed the movement commands so quickly that the robot does not have time to physically react.

    Did You Know?

    Did you know?

    Point Turns vs. Swing Turns

    The "turnLeft" and "turnRight" commands in ROBOTC only execute "point turns", where one wheel moves forward and the other wheel moves backwards.

    A swing turn is a different type of turn that will allow your robot to turn by pivoting - one wheel moves forward, the other wheel remains stationary.

    Different types of turns allow your robot to navigate around obstacles easier.

    Encoders - Mini Challenge

    Mini Challenge 1: Turn of Time

    Program the robot to make a 90 degree turn using a specific amount of time.
    • On a table, create an 90 degree right angle and have the robot start on one of the lines and finish on the other, but this time use only time (seconds).

    Mini Challenge PDF[ Turn for Time Challenge.pdf ]