This block will run the motor, connected to a specified hub port, at a specified power, for a specified amount of time.
Run the motor for a specified time block as first input accepts Hub port address. Each hub port has a physical letter printed on its body.
Run the motor for a specified time 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.
Run the motor for a specified time block as third input accepts time value in seconds
The coding block is compatible with all hubs.
The coding block is compatible with motors that have a speed sensor.
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 | yes |
Move Hub | yes |
LEGO® Powered UP App coding example: Run the motor for a specified time
For this example, you will need:
- Hub – any hub from Hubs compatible with LEGO® Powered UP App list will work
- Motor – any motor that has speed sensor from Motors compatible with LEGO® Powered UP App list will work
Step 1: Add coding blocks
- Flow block – Start
- Motor block – Run the motor for a specified time, select hub port A, select power 100, select time 3
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, but only for 3 seconds. 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.
Leave a Reply Cancel reply