This chapter discusses the following functions of the Stepper library:
The hardware needed to use these functions includes:
- Arduino Uno
- 1 x L293D
- 1 x 5-V bipolar stepper motor
Electric motors generally work by creating electromagnetic fields from coils, forcing magnets on an axle to move, therefore driving the axle. By generating electromagnetic fields, a motor turns continuously until current is removed.
Servo motors (presented in Chapter 14) function a little differently, but even if their usage is different, a servo motor is still controlled by an ordinary electric motor managed by a small microcontroller to ensure the servo motor can move to a precise position.
Stepper motors are different. They have several coils inside, and the internal axle is “toothed.” When applying current to one of the coils, the closest “tooth” is attracted to the coil, and the axle moves by a few degrees. Current is then removed from the coil and sent through another coil, again attracting a tooth and moving the axle by a few degrees. By repeating this operation, a stepper motor can be controlled to turn continuously in either direction, but this is not normally a stepper motor's main function. Stepper motors can have precise ...