Builder: all pages

Give motors and servos a name and a port

On this page you will give each motor and servo on your robot a name to use in code. You will also set the hub it is connected to and its port. This information is saved with the project and goes with the robot to Sim.

Properties panel with the motor's name, hub and port fields filled in.

Before you start

Name a motor

  1. In the Left panel, select the Parts tab.
  2. Type Motor in the Search in parts... box.
  3. In the list, select the first REV HD Hex Motor row.
  4. In the Hardware section of the Properties panel, type solMotor in the Name box.
  5. Press Enter. Hardware section; the Name box is marked with number 4.

Result: In the Parts list, the motor's row shows "solMotor" next to its name.

Select the hub, port and direction

  1. In the Hardware section, select Control Hub or Expansion Hub from the Hub list. At first it shows Control Hub.
  2. Select 0 from the Port list. The first option is Not set.
  3. If the motor turns the wrong way, check the Reverse direction checkbox. Hardware section; Hub marked 1, Port marked 2, Reverse direction marked 3.

Result: The Hardware section shows the hub and port you selected and the Reverse direction check mark.

Fix a port conflict

Two motors on the same hub cannot use the same port. Motor ports and servo ports are counted separately: motor port 0 and servo port 0 can be on the same hub.

  1. In the Parts list, select the second REV HD Hex Motor row.
  2. Type sagMotor in the Name box and press Enter.
  3. From the Hub list, select the same hub as the first motor.
  4. Select 0 from the Port list. The warning "Port 0 is used by another motor" appears below the section.
  5. Select 1 from the Port list. Hardware section; the "Port 0 is used by another motor" warning and the Port list are marked with number 4.

Result: The warning goes away. Each motor has its own name and its own port.

Find out where this information goes

Having trouble?

Next step

On this page
Before you startName a motorSelect the hub, port and directionFix a port conflictFind out where this information goesHaving trouble?Next step