Report motor speed

This block will report the speed of the motor, connected to a specified port.

Report motor speed has one input and one output. The input value is the port address, to which the motor is connected.
The output value is the motor speed.

This coding block is compatible will all hubs and motors.

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: Add a motor speed dial

For this example, you will need:

Step 1: Add coding blocks

Motor coding strip

  • Flow block – Start  
  • Flow block – Repeat instructions infinitely
  • Motor block – Start motor, select hub port A
  • Widget block – Slider widget, select address 0

Speed dial coding strip

  • Flow block – Start 
  • Flow block – Repeat instructions infinitely
  • Widget block – Display widget, select address 1
  • Motor block – Report motor speed, select hub port A

Step 2: Add canvas elements

  • Add Slider, set address to 0
  • Add Speed dial, set address 1

Step 3: Configure slider. Set ‘return to 0’ in the Slider options menu

Step 4: Setup motor and hub

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

Step 5:

  • Navigate to the Application control view
  • Observe that when the program starts, the motor is not spinning
  • Use the Canvas slider
  • Observe that the motor starts to spin, and the Canvas speed dial displays the speed value

Back to Motor Blocks page