Main Content

Motor

Control power and direction of EV3 motor

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

  • Motor block

Libraries:
Simulink Support Package for LEGO MINDSTORMS EV3 Hardware

Description

Use the Motor block to control the power and direction of an EV3 motor. You can use this block with the Encoder block to measure the rotation of a motor connected to an EV3 brick.

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

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

Ports

Input

expand all

The block inputs these values that determine the direction and power of an EV3 motor.

  • 1 to 100 — Input the values to the block in this range to move the motor in the forward direction. 1 indicates minimum power and 100 indicates maximum power in the forward direction.

  • -1 to -100 — Input the values to the block in this range to move the motor in the reverse direction. -1 indicates minimum power and -100 indicates maximum power in the reverse direction.

  • 0 — No power

Data Types: int8

Parameters

expand all

Select the EV3 brick output port to which the motor is connected. If your Simulink® model contains both the Motor and Encoder blocks, set the EV3 brick output port parameter in both the blocks to the same port.

Version History

Introduced in R2012a