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 name | Compatible |
WeDo 2.0 Medium Motor | no |
Medium Linear Motor | yes |
Technic™ Large Motor | yes |
Technic™ XL Motor | yes |
Technic™ Small Angular Motor | yes |
Medium Angular Motor | yes |
Large Angular Motor | yes |
Train Motor | no |
Move Hub | yes |
LEGO® Powered UP App coding example: Add a motor speed dial
For this example, you will need:
- Hub – any hub from Hubs compatible with LEGO® Powered UP App list will work
- Motor – not any motor from Motors compatible with LEGO® Powered UP App list will work, please select motors that have the Speed sensor option
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