Motor Carrier
Control servo, DC motors M1 and M2 in closed loop control using two encoder inputs
on the MKR Motor Carrier or Nano Motor Carrier. Create arduino
object before using the motor carrier functions. See Connect to Arduino Hardware for more information.
Functions
Motor Carrier
motorCarrier | Connection to Arduino MKR Motor Carrier or Nano Motor Carrier (Since R2020b) |
DC Motor
PID Motor
pidMotor | Connection to motors in closed-loop PID control on Arduino MKR Motor Carrier or Nano Motor Carrier (Since R2020a) |
readAngularPosition | Read angular position of DC Motor in closed-loop control (Since R2020a) |
readSpeed | Read current rotational speed of DC Motor in closed loop control (Since R2020a) |
writeAngularPosition | Rotate DC motor by specified angle in closed loop position control (Since R2020a) |
writeSpeed | Write speed of PID motor (Since R2020a) |
Rotary Encoder
rotaryEncoder | Connection to rotary encoder on Arduino MKR Motor Carrier or Nano Motor Carrier (Since R2020a) |
readCount | Read current count value from encoder connected to MKR Motor Carrier or Nano Motor Carrier (Since R2020a) |
readSpeed | Read current rotational speed of motor from rotary encoder (Since R2020a) |
resetCount | Set encoder count value to zero or specified value (Since R2020a) |
Servo Motor
servo | Connection to servo motor on Arduino MKR Motor Carrier or Nano Motor Carrier (Since R2020a) |
writePosition | Write position of servo motor connected to MKR Motor Carrier or Nano Motor Carrier (Since R2020a) |
Topics
- Using Arduino Engineering Kit Rev 2 with Pre-Configured Projects in Support Package
Learn how to use Arduino® Engineering Kit Rev 2 with the support package.
Featured Examples
Webcam Controlled Rover Using Arduino Engineering Kit Rev 2
Use Arduino® Engineering Kit Rev 2 to program a differential drive robot that can be remotely controlled by MATLAB® over Wi-Fi® to perform operations such as path following and moving objects with a forklift along with obstacle avoidance.
Drawing Robot Using Arduino Engineering Kit Rev 2
Use Arduino® Engineering Kit Rev 2 to build and program a robot that extracts line traces from an image and reproduces it as a drawing on a whiteboard. The project uses MATLAB® code to capture an image using a webcam, and then convert it into a set of motor commands using image processing techniques, which drive the robot across a whiteboard and reproduce the captured image as a drawing.
Self-Balancing Motor Cycle Using Arduino Engineering Kit Rev 2
Use Arduino® Engineering Kit Rev 2 to build and program a motorcycle bot that self-balances and maneuvers by itself using a flywheel. The project models the motorcycle with the help of inverted pendulum dynamics and performs inertial sensing to balance the motorcycle by controlling the flywheel, located at the center of the motorcycle.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)