Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
TUTORIALS (/EN/TUTORIAL/HOMEPAGE) > Examples from Libraries (/en/Tutorial/LibraryExamples) > Stepper > MotorKnob
For more information about the differences of the two types, please take a look at Tom Igoe's page on stepper motors
(http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors).
Hardware Required
-
stepper motor
hook-up wires
breadboard
Circuits
Below you'll nd circuits for both unipolar and bipolar steppers. In either case, it is best to power your stepper motors from an external
supply, as they draw too much to be powered directly from your Arduino board.
In both circuits, connect a 10k pot to power and ground, with it's wiper outputting to analog pin 0.
Note: Both circuits below are four wire congurations. Two wire congurations will not work with the code provided.
Unipolar Stepper Circuit and schematic
Code
For both unipolar and bipolar steppers
/*
* MotorKnob
*
* A stepper motor follows the turns of a potentiometer
* (or other sensor) on analog input 0.
*
* http://www.arduino.cc/en/Reference/Stepper
* This example code is in the public domain.
*/
#include <Stepper.h>
See also
-
stepper.setSpeed (//www.arduino.cc/en/Reference/StepperSetSpeed)()
stepper.step (//www.arduino.cc/en/Reference/StepperStep)()
StepperOneRevolution (//www.arduino.cc/en/Tutorial/StepperOneRevolution) - Turn the shaft one revolution clockwise and one
counterclockwise.
Share
NEWSLETTER
2016 Arduino
About us (//www.arduino.cc/en/Main/AboutUs)
(https://twitter.com/arduino)
Contact us (//www.arduino.cc/en/Main/ContactUs)
Careers (//www.arduino.cc/Careers)
(https://www.facebook.com/ocial.arduino)
(https://www.ickr.com/photos/arduino_cc)
(https://youtube.com/arduinoteam)
(https://plus.google.com/+Arduino)