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
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
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