pidMotor
Connection to motors in closed-loop PID control on Arduino MKR Motor Carrier or Nano Motor Carrier
Since R2020a
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
This object represents a connection to motors running in closed-loop PID control with the specified motor number on the MKR Motor Carrier or Nano Motor Carrier. You can control the DC motors M1 and M2 in closed-loop PID control using the functions in Object Functions.
Creation
Syntax
Description
creates a connection to the PID motor at the specified port number and the specified
control mode on the Arduino MKR Motor Carrier or the Nano Motor Carrier.pidObj
= pidMotor(mcObj
,PIDNumber
,controlmode
)
creates a connection to the PID motor at the specified port number with the specified
pulses per revolution on the Arduino MKR Motor Carrier or the Nano Motor Carrier.pidObj
= pidMotor(mcObj
,PIDNumber
,controlmode
,ppr
)
creates a connection to the PID motor at the specified port number and specified PID gains
on the Arduino MKR Motor Carrier or the Nano Motor Carrier.pidObj
= pidMotor(mcObj
,PIDNumber
,controlmode
,ppr
,[PIDGains]
)
Input Arguments
Properties
Object Functions
Use these object functions to create a connection to the PID motor:
readAngularPosition | Read angular position of DC Motor in closed-loop control |
readSpeed | Read current rotational speed of DC Motor in closed loop control |
writeAngularPosition | Rotate DC motor by specified angle in closed loop position control |
writeSpeed | Write speed of PID motor |
Examples
Version History
Introduced in R2020a
See Also
arduino
| dcmotor
| motorCarrier
| rotaryEncoder
| servo