Position 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. This block remembers an axle rotation value from the beginning of the program.

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

Position 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.

Position 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, then return to the starting position

For this example, you will need:

Step 1: Add coding blocks

  • Flow block – Start  
  • Motor block – Position axle select hub port A, select power 50, select turn angle 360
  • Flow block – Wait set value to 5 seconds.
  • Motor block – Position axle select hub port A, select power 50, select turn angle 0

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 axle turns one full rotation and stops, after the pause of 5 seconds it returns to the original position.

Main difference between Position axle and Rotate axle, is that Position axle command remembers rotation value of motor’s axle. For example: If you run a coding block for Position axle and Rotate axle, and tell them to rotate an axle by 360, both blocks will execute the program the first time. However, if you run the program again, only Rotate axle will rotate the motor axle. This is because Position axle remembers a value from the last code execution.

Back to Motor Blocks page

Comments

Leave a Reply

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