Run motor

This block will run the motor, connected to a specified hub port, at a specified power.

Run motor block as first input accepts Hub port address. Each hub port has a physical letter printed on its body.

Run motor block as a second input accepts motor power value. Values can range from -100 to 100. When the value is a positive number, the motor spins clockwise, when the value is a negative number, the motor spins counterclockwise.

The coding block is compatible with all hubs.

The coding block is compatible with motors that have a speed sensor.

Device nameCompatible
WeDo 2.0 Medium Motorno
Medium Linear Motoryes
Technic™ Large Motoryes
Technic™ XL Motoryes
Technic™ Small Angular Motoryes
Medium Angular Motoryes
Large Angular Motoryes
Train Motoryes
Move Hubyes

LEGO® Powered UP App coding example: Run motor

For this example, you will need:

Step 1: Add coding blocks

  • Flow block – Start  
  • Motor block – Run motor, select hub port A, select power 100

Step 2: Setup motor and hub

  • Connect the motor to port A
  • Connect the hub to a device that runs the Powered UP App

Step 3: Run the program. Observe that the motor is spinning at full power. Observe, that when you start the program and change power value, nothing changes. For changes to apply in this example, you need to restart the program.

Back to Motor Blocks page

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *