1
1
/*
2
- Stepper.h - - Stepper library for Wiring/Arduino - Version 0.4
2
+ Stepper.h - - Stepper library for Wiring/Arduino - Version 0.5
3
3
4
4
Original library (0.1) by Tom Igoe.
5
5
Two-wire modifications (0.2) by Sebastian Gassner
6
6
Combination version (0.3) by Tom Igoe and David Mellis
7
7
Bug fix for four-wire (0.4) by Tom Igoe, bug fix from Noah Shibley
8
+ High-speed stepping mod and timer rollover fix (0.5) by Eugene Kozlenko
8
9
9
10
Drives a unipolar or bipolar stepper motor using 2 wires or 4 wires
10
11
18
19
A slightly modified circuit around a Darlington transistor array or an L293 H-bridge
19
20
connects to only 2 microcontroler pins, inverts the signals received,
20
21
and delivers the 4 (2 plus 2 inverted ones) output signals required
21
- for driving a stepper motor.
22
+ for driving a stepper motor. Similarly the Arduino motor shields 2 direction pins
23
+ may be used.
22
24
23
25
The sequence of control signals for 4 control wires is as follows:
24
26
@@ -79,7 +81,7 @@ class Stepper {
79
81
80
82
int direction; // Direction of rotation
81
83
int speed; // Speed in RPMs
82
- unsigned long step_delay; // delay between steps, in ms , based on speed
84
+ unsigned long step_delay; // delay between steps, in us , based on speed
83
85
int number_of_steps; // total number of steps this motor can take
84
86
int pin_count; // whether you're driving the motor with 2 or 4 pins
85
87
int step_number; // which step the motor is on
@@ -90,7 +92,7 @@ class Stepper {
90
92
int motor_pin_3;
91
93
int motor_pin_4;
92
94
93
- long last_step_time; // time stamp in ms of when the last step was taken
95
+ unsigned long last_step_time; // time stamp in us of when the last step was taken
94
96
};
95
97
96
98
#endif
0 commit comments