Rotate axle

This block will rotate the motor axle, for the motor connected to a specified hub port, at a specified power, for a specified amount of degrees.

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

Rotate axle  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.

Rotate axle block as a third input accepts axle turn angle, 360 is full axle rotation

The coding block is compatible with all hubs.

The coding block is compatible with motors that have a rotation 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 Motorno
Move Hubyes

LEGO® Powered UP App coding example: Rotate motor axle 1 turn

For this example, you will need:

Step 1: Add coding blocks

  • Flow block – Start  
  • Motor block – Rotate axle select hub port A, select power 50, select turn angle 360

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 turns one full rotation and stops.

Step 4 (optional): Change the axle turn angle to 0 and restart the program. Observe that a motor axle does not rotate.

Back to Motor Blocks page

Comments

Leave a Reply

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