Main Content

move

Rotate stepper motor connected to Adafruit Motor Shield

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

Description

move(sm,steps) rotates the stepper motor for the specified number of steps. The move command blocks MATLAB® while the stepper motor is rotating.

example

Examples

collapse all

Connect to Arduino® hardware and create an add-on connection to an Adafruit® Motor Shield.

a = arduino('COM4','Uno','Libraries','Adafruit/MotorShieldV2');
shield = addon(a,'Adafruit/MotorShieldV2');

Create a stepper motor connection to motor number 1 on the shield, with steps per revolution of 200 and an RPM of 10.

sm = stepper(shield,1,200,'RPM',10);

Rotate the motor 10 steps.

move(sm,10);

The move command blocks MATLAB while it executes.

Input Arguments

collapse all

Stepper motor connection, specified as a stepper motor object, created using the stepper function.

Number of steps that the stepper motor rotates, specified as a number.

Version History

Introduced in R2014b