Main Content

L293D DC Motor

Control power and direction of a DC motor

Since R2023a

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

  • M1 M2 DC Motors block

Libraries:
Simulink Support Package for Arduino Hardware / Common

Description

The L293D DC Motor block controls power and direction of a DC motor connected to motor driver shields such as L293D and L298N.

Supported Hardware

The L293D DC Motor block supports all Arduino boards.

Ports

Input

expand all

The sign of the input signal determines the direction of rotation of the DC motor. A positive sign indicates a forward rotation, whereas a negative sign indicates a reverse rotation. The amplitude determines the power supplied to the motor.

  • 1 to 100: Forward rotation, minimum to maximum power.

  • –1 to –100: Reverse rotation, minimum to maximum power.

  • 0: No power is supplied.

Any out-of-range values, at the block input port has the same effect as the maximum or minimum input values.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Parameters

expand all

Specify the enable pin number on the motor driver shield to which the DC motor is connected.

Specify the Input A pin number on the motor driver shield that is connected to the DC motor.

Do not assign the same pin number to more than one DC Motor block within the same model.

Specify the Input B pin number on the motor driver shield that is connected to the DC motor.

Do not assign the same pin number to more than one DC Motor block within the same model.

Version History

Introduced in R2023a