motorCarrier
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
This object represents a connection to an MKR Motor Carrier or a Nano Motor Carrier. To communicate with peripherals connected to the MKR Motor Carrier or the Nano Motor Carrier, create connections to the peripherals using the functions listed under Object Functions.
The motorCarrier
object uses the arduino
object to
establish connection to these supported boards:
MKR1000, MKR1010, and MKRZero (for MKR Motor Carrier)
Nano33IoT (for Nano Motor carrier)
Creation
Description
creates a connection to the MKR Motor Carrier or Nano Motor Carrier.mcObj
= motorCarrier(arduinoObj
)
Input Arguments
Properties
Object Functions
Use these object functions to use the peripherals on the MKR Motor Carrier or Nano Motor Carrier:
servo | Connection to servo motor on Arduino MKR Motor Carrier or Nano Motor Carrier |
dcmotor | Connection to DC Motor on Arduino MKR Motor Carrier or Nano Motor Carrier |
pidMotor | Connection to motors in closed-loop PID control on Arduino MKR Motor Carrier or Nano Motor Carrier |
rotaryEncoder | Connection to rotary encoder on Arduino MKR Motor Carrier or Nano Motor Carrier |
Examples
Create a Connection to MKR Motor Carrier
Create an arduino
object with the
'MotorCarrier
' library.
arduinoObj = arduino('COM13','MKR1000','Libraries','MotorCarrier')
arduinoObj = arduino with properties: Port: 'COM13' Board: 'MKR1000' AvailablePins: {'D0-D14', 'A0-A6'} AvailableDigitalPins: {'D0-D14', 'A0-A6'} AvailablePWMPins: {'D0-D8', 'D10', 'A3-A4'} AvailableAnalogPins: {'A0-A6'} AvailableI2CBusIDs: [0] Libraries: {'MotorCarrier'} Show all properties
Create a connection to the MKR Motor Carrier.
mcObj = motorCarrier(arduinoObj)
mcObj = MotorCarrier with properties: SCLPin: 'D11' SDAPin: 'D12' I2CAddress: 102 ('0x66')
Create a Connection to Nano Motor Carrier
Create an arduino
object with the
'MotorCarrier
' library.
arduinoObj = arduino('COM11','Nano33IoT','Libraries','MotorCarrier');
arduinoObj = arduino with properties: Port: 'COM11' Board: 'Nano33IoT' AvailablePins: {'D0-D13', 'A0-A7'} AvailableDigitalPins: {'D0-D13', 'A0-A7'} AvailablePWMPins: {'D2-D6', 'D9-D12', 'A2-A3', 'A5'} AvailableAnalogPins: {'A0-A3','A6-A7'} AvailableI2CBusIDs: [0] AvailableSerialPortIDs: [1] Libraries: {'MotorCarrier'} Show all properties
Create a connection to the Nano Motor Carrier.
mcObj = motorCarrier(arduinoObj);
mcObj = MotorCarrier with properties: SCLPin: 'A5' SDAPin: 'A4' I2CAddress: 102 ('0x66')
Version History
Introduced in R2020b
See Also
arduino
| dcmotor
| pidMotor
| rotaryEncoder
| servo