M3 M4 DC Motors
Control speed and direction of DC motor on port M3 or M4
Simulink Support Package for Arduino Hardware / Arduino Motor Carrier
The M3 M4 DC Motors block controls the speed and direction of a DC motor connected to an MKR Motor Carrier. The input signal determines the power supplied to the motor and the direction of rotation of the motor.
If you simulate a model that contains the M3 M4 DC Motors block without connecting the hardware, the block outputs zeroes. See Block Produces Zeros or Does Nothing in Simulation.
You can use the M3 M4 DC Motors block only with MKR and Nano 33 IoT boards.
Port_1 — Input signal
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.
255: Forward rotation, minimum to maximum power.
–255: 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. For example, a value
500 is interpreted as the maximum value, 100.The
block input inherits the data type of the upstream block and internally
converts the input to
Motor port — Port number on MKR Motor Carrier
M3 (default) |
Select the port number on the MKR Motor Carrier to which the DC motor is connected.
Introduced in R2019a