Main Content

Motor

Control motor power and direction

Add-On Required: This feature requires the Simulink Support Package for LEGO MINDSTORMS EV3 Hardware add-on.

Library

Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware

  • Motor block

Description

Control the power and direction of an EV3 Motor.

You can use this block with the Encoder block, which measures rotation of the motor.

The block input accepts values from 100 to -100 :

  • 1 to 100 = Forward, minimum to maximum power, when input is greater than 100, the input value is saturated to 100.

  • -1 to -100 = Reverse, minimum to maximum power, when input is less than –100, the input values is saturated to –100.

  • 0 = No power

During simulations without hardware, this block does nothing. See Block Produces Zeros or Does Nothing in Simulation.

This block converts the data type of the values it receives. You do not need to convert the data type of the input signal.

Parameters

EV3 brick output port

Select the EV3 brick output port connected to the motor. The options are A, B, C, or D.