Help CenterHelp Center
Rotate stepper motor connected to Adafruit Motor Shield
move(sm,steps)
example
move(sm,steps) rotates the stepper motor for the specified number of steps. The move command blocks MATLAB® while the stepper motor is rotating.
sm
steps
move
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.
1
sm = stepper(shield,1,200,'RPM',10);
Rotate the motor 10 steps.
move(sm,10);
The move command blocks MATLAB while it executes.
Stepper motor connection, specified as a stepper motor object, created using the stepper function.
stepper
Number of steps that the stepper motor rotates, specified as a number.
Introduced in R2014b
release | addon | stepper | arduino
release
addon
arduino
You have a modified version of this example. Do you want to open this example with your edits?
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:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office