diff --git a/LICENSE b/LICENSE index 814fc7b..52998af 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -This software is Copyright (C) 2008 Mike McCauley. Use is subject to license +This software is Copyright (C) Mike McCauley. Use is subject to license conditions. The main licensing options available are GPL V3 or Commercial: Open Source Licensing GPL V3 @@ -14,4 +14,4 @@ Commercial Licensing This is the appropriate option if you are creating proprietary applications and you are not prepared to distribute and share the source code of your -application. Contact info@open.com.au for details. +application. Contact info@airspayce for details. diff --git a/extras/doc/annotated.html b/extras/doc/annotated.html index 7f48b6f..e60691d 100644 --- a/extras/doc/annotated.html +++ b/extras/doc/annotated.html @@ -1,9 +1,9 @@ - +
- +
- 1.8.13
+Generated by This is the complete list of members for AccelStepper, including all inherited members.
| _direction | AccelStepper | protected |
| _stepInterval | AccelStepper | protected |
| acceleration() | AccelStepper | |
| AccelStepper(uint8_t interface=AccelStepper::FULL4WIRE, uint8_t pin1=2, uint8_t pin2=3, uint8_t pin3=4, uint8_t pin4=5, bool enable=true) | AccelStepper | |
| AccelStepper(void(*forward)(), void(*backward)()) | AccelStepper | |
| computeNewSpeed() | AccelStepper | protected |
| computeNewSpeed() | AccelStepper | protectedvirtual |
| currentPosition() | AccelStepper | |
| Direction enum name | AccelStepper | protected |
| DIRECTION_CCW enum value | AccelStepper | protected |
| step4(long step) | AccelStepper | protectedvirtual |
| step6(long step) | AccelStepper | protectedvirtual |
| step8(long step) | AccelStepper | protectedvirtual |
| stepBackward() | AccelStepper | protected |
| stepForward() | AccelStepper | protected |
| stop() | AccelStepper | |
| targetPosition() | AccelStepper | |
| ~AccelStepper() | AccelStepper | inlinevirtual |
- 1.8.13
+Generated by @@ -88,8 +89,10 @@ Public Member Functions | |
| float | maxSpeed () |
| void | setAcceleration (float acceleration) |
| void | setAcceleration (float acceleration) |
| float | acceleration () |
| void | setSpeed (float speed) |
| float | speed () |
| bool | isRunning () |
| +virtual | ~AccelStepper () |
| Virtual destructor to prevent warnings during delete. | |
Protected Types | |
| enum | Direction { DIRECTION_CCW = 0, -DIRECTION_CW = 1 - } |
| Direction indicator Symbolic names for the direction the motor is turning. More... | |
| enum | Direction { DIRECTION_CCW = 0 +, DIRECTION_CW = 1 + } |
| Direction indicator Symbolic names for the direction the motor is turning. More... | |
Protected Member Functions | |
| void | computeNewSpeed () |
| virtual unsigned long | computeNewSpeed () |
| virtual void | setOutputPins (uint8_t mask) |
| virtual void | step (long step) |
| long | stepForward () |
| long | stepBackward () |
| virtual void | step0 (long step) |
| virtual void | step1 (long step) |
| boolean | _direction |
| unsigned long | _stepInterval |
Support for stepper motors with acceleration etc.
This defines a single 2 or 4 pin stepper motor, or stepper moter with fdriver chip, with optional acceleration, deceleration, absolute positioning commands etc. Multiple simultaneous steppers are supported, all moving at different speeds and accelerations.
Gregor Christandl reports that with an Arduino Due and a simple test program, he measured 43163 steps per second using runSpeed(), and 16214 steps per second using run();
Symbolic names for number of pins. Use this in the pins argument the AccelStepper constructor to provide a symbolic name for the number of pins to use.
+Symbolic names for number of pins. Use this in the pins argument the AccelStepper constructor to provide a symbolic name for the number of pins to use.
| Enumerator | |||||
|---|---|---|---|---|---|
| FUNCTION | Use the functional interface, implementing your own driver functions (internal use only) | ||||
| [in] | interface | Number of pins to interface to. Integer values are supported, but it is preferred to use the MotorInterfaceType symbolic names. AccelStepper::DRIVER (1) means a stepper driver (with Step and Direction pins). If an enable line is also needed, call setEnablePin() after construction. You may also invert the pins using setPinsInverted(). Caution: DRIVER implements a blocking delay of minPulseWidth microseconds (default 1us) for each step. You can change this with setMinPulseWidth(). AccelStepper::FULL2WIRE (2) means a 2 wire stepper (2 pins required). AccelStepper::FULL3WIRE (3) means a 3 wire stepper, such as HDD spindle (3 pins required). AccelStepper::FULL4WIRE (4) means a 4 wire stepper (4 pins required). AccelStepper::HALF3WIRE (6) means a 3 wire half stepper, such as HDD spindle (3 pins required) AccelStepper::HALF4WIRE (8) means a 4 wire half stepper (4 pins required) Defaults to AccelStepper::FULL4WIRE (4) pins. | |||
| [in] | pin1 | Arduino digital pin number for motor pin 1. Defaults to pin 2. For a AccelStepper::DRIVER (interface==1), this is the Step input to the driver. Low to high transition means to step) | |||
| [in] | pin2 | Arduino digital pin number for motor pin 2. Defaults to pin 3. For a AccelStepper::DRIVER (interface==1), this is the Direction input the driver. High means forward. | |||
| [in] | interface | Number of pins to interface to. Integer values are supported, but it is preferred to use the MotorInterfaceType symbolic names. AccelStepper::DRIVER (1) means a stepper driver (with Step and Direction pins). If an enable line is also needed, call setEnablePin() after construction. You may also invert the pins using setPinsInverted(). Caution: DRIVER implements a blocking delay of minPulseWidth microseconds (default 1us) for each step. You can change this with setMinPulseWidth(). AccelStepper::FULL2WIRE (2) means a 2 wire stepper (2 pins required). AccelStepper::FULL3WIRE (3) means a 3 wire stepper, such as HDD spindle (3 pins required). AccelStepper::FULL4WIRE (4) means a 4 wire stepper (4 pins required). AccelStepper::HALF3WIRE (6) means a 3 wire half stepper, such as HDD spindle (3 pins required) AccelStepper::HALF4WIRE (8) means a 4 wire half stepper (4 pins required) Defaults to AccelStepper::FULL4WIRE (4) pins. | |||
| [in] | pin1 | Arduino digital pin number for motor pin 1. Defaults to pin 2. For a AccelStepper::DRIVER (interface==1), this is the Step input to the driver. Low to high transition means to step) | |||
| [in] | pin2 | Arduino digital pin number for motor pin 2. Defaults to pin 3. For a AccelStepper::DRIVER (interface==1), this is the Direction input the driver. High means forward. | |||
| [in] | pin3 | Arduino digital pin number for motor pin 3. Defaults to pin 4. | |||
| [in] | pin4 | Arduino digital pin number for motor pin 4. Defaults to pin 5. | |||
| [in] | enable | If this is true (the default), enableOutputs() will be called to enable the output pins at construction time. |
| float AccelStepper::acceleration | +( | +) | ++ |
Returns the acceleration/deceleration rate configured for this stepper that was previously set by setAcceleration();
Referenced by setAcceleration().
+ +| void AccelStepper::computeNewSpeed | +unsigned long AccelStepper::computeNewSpeed | ( | ) | @@ -354,7 +387,7 @@ Protected Attributes |
References _direction, DIRECTION_CCW, DIRECTION_CW, and distanceToGo().
+References _direction, _stepInterval, DIRECTION_CCW, DIRECTION_CW, and distanceToGo().
Referenced by moveTo(), run(), setAcceleration(), and setMaxSpeed().
@@ -435,7 +469,7 @@ Protected AttributesThe distance from the current position to the target position.
Referenced by computeNewSpeed(), and run().
+Referenced by computeNewSpeed(), and run().
References computeNewSpeed().
+References computeNewSpeed().
Referenced by move(), MultiStepper::moveTo(), and runToNewPosition().
@@ -579,7 +613,7 @@ Protected AttributesPoll the motor and step it if a step is due, implementing accelerations and decelerations to achieve the target position. You must call this as frequently as possible, but at least once per minimum step time interval, preferably in your main loop. Note that each call to run() will make at most one step, and then only when a step is due, based on the current speed and the time since the last step.
References computeNewSpeed(), distanceToGo(), and runSpeed().
+References computeNewSpeed(), distanceToGo(), and runSpeed().
Referenced by runToPosition().
@@ -601,9 +635,9 @@ Protected AttributesPoll the motor and step it if a step is due, implementing a constant speed as set by the most recent call to setSpeed(). You must call this as frequently as possible, but at least once per step interval,
References _direction, DIRECTION_CW, and step().
+References _direction, _stepInterval, DIRECTION_CW, and step().
-Referenced by MultiStepper::run(), run(), and runSpeedToPosition().
+Referenced by run(), MultiStepper::run(), and runSpeedToPosition().
Runs at the currently selected speed until the target position is reached. Does not implement accelerations.
Executes runSpeed() unless the targetPosition is reached. This function needs to be called often just like runSpeed() or run(). Will step the motor if a step is required at the currently selected speed unless the target position has been reached. Does not implement accelerations.
References _direction, DIRECTION_CCW, DIRECTION_CW, and runSpeed().
@@ -697,7 +731,7 @@ Protected Attributes -References computeNewSpeed().
+References acceleration(), and computeNewSpeed().
Referenced by AccelStepper().
@@ -725,6 +759,8 @@ Protected Attributes +References _stepInterval.
+Referenced by MultiStepper::run().
References computeNewSpeed(), and speed().
+References computeNewSpeed(), and speed().
+ +Referenced by AccelStepper().
@@ -797,7 +835,8 @@ Protected AttributesSets the minimum pulse width allowed by the stepper driver. The minimum practical pulse width is approximately 20 microseconds. Times less than 20 microseconds will usually result in 20 microseconds or so.
| [in] | minWidth | The minimum pulse width in microseconds. |
| [in] | minWidth | The minimum pulse width in microseconds. + |
References _direction, DIRECTION_CCW, DIRECTION_CW, and speed().
+References _direction, _stepInterval, DIRECTION_CCW, DIRECTION_CW, and speed().
Referenced by MultiStepper::moveTo().
@@ -1013,7 +1052,7 @@ Protected AttributesReferences DRIVER, FULL2WIRE, FULL3WIRE, FULL4WIRE, FUNCTION, HALF3WIRE, HALF4WIRE, step0(), step1(), step2(), step3(), step4(), step6(), and step8().
-Referenced by runSpeed().
+Referenced by runSpeed(), step0(), step1(), step2(), step3(), step4(), step6(), step8(), stepBackward(), and stepForward().
References step().
+Referenced by step().
@@ -1081,7 +1122,7 @@ Protected Attributes -References _direction, and setOutputPins().
+References _direction, setOutputPins(), and step().
Referenced by step().
@@ -1117,7 +1158,7 @@ Protected Attributes -References setOutputPins().
+References setOutputPins(), and step().
Referenced by step().
@@ -1153,7 +1194,7 @@ Protected Attributes -References setOutputPins().
+References setOutputPins(), and step().
Referenced by step().
@@ -1189,7 +1230,7 @@ Protected Attributes -References setOutputPins().
+References setOutputPins(), and step().
Referenced by step().
@@ -1225,7 +1266,7 @@ Protected Attributes -References setOutputPins().
+References setOutputPins(), and step().
Referenced by step().
@@ -1254,17 +1295,73 @@ Protected AttributesCalled to execute a step on a 4 pin half-steper motor. Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default sets or clears the outputs of pin1, pin2, pin3, pin4.
Called to execute a step on a 4 pin half-stepper motor. Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default sets or clears the outputs of pin1, pin2, pin3, pin4.
| [in] | step | The current step phase number (0 to 7) |
References setOutputPins().
+References setOutputPins(), and step().
Referenced by step().
+
+
|
+ +protected | +
+
|
+ +protected | +
Current direction motor is spinning in Protected because some peoples subclasses need it to be so
-Referenced by AccelStepper(), computeNewSpeed(), runSpeed(), runSpeedToPosition(), setSpeed(), and step1().
+Referenced by AccelStepper(), computeNewSpeed(), runSpeed(), runSpeedToPosition(), setSpeed(), and step1().
+ +
+
|
+ +protected | +
The current interval between steps in microseconds. 0 means the motor is currently stopped with _speed == 0
+ +Referenced by AccelStepper(), computeNewSpeed(), runSpeed(), setCurrentPosition(), and setSpeed().
- 1.8.13
+Generated by
- 1.8.13
+Generated by
- 1.8.13
+Generated by
- 1.8.13
+Generated by This is the Arduino AccelStepper library. It provides an object-oriented interface for 2, 3 or 4 pin stepper motors and motor drivers.
+This is the Arduino AccelStepper library. It provides an object-oriented interface for 2, 3 or 4 pin stepper motors and motor drivers.
The standard Arduino IDE includes the Stepper library (http://arduino.cc/en/Reference/Stepper) for stepper motors. It is perfectly adequate for simple, single motor applications.
-AccelStepper significantly improves on the standard Arduino Stepper library in several ways:
AccelStepper significantly improves on the standard Arduino Stepper library in several ways:
The latest version of this documentation can be downloaded from http://www.airspayce.com/mikem/arduino/AccelStepper The version of the package that this documentation refers to can be downloaded from http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.61.zip
+The latest version of this documentation can be downloaded from http://www.airspayce.com/mikem/arduino/AccelStepper The version of the package that this documentation refers to can be downloaded from http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.64.zip
Example Arduino programs are included to show the main modes of use.
You can also find online help and discussion at http://groups.google.com/group/accelstepper Please use that group for all questions and discussions on this topic. Do not contact the author directly, unless it is to discuss commercial licensing. Before asking a question or reporting a bug, please read
Beginners to C++ and stepper motors in general may find this helpful:
Tested on Arduino Diecimila and Mega with arduino-0018 & arduino-0021 on OpenSuSE 11.1 and avr-libc-1.6.1-1.15, cross-avr-binutils-2.19-9.1, cross-avr-gcc-4.1.3_20080612-26.5. Tested on Teensy http://www.pjrc.com/teensy including Teensy 3.1 built using Arduino IDE 1.0.5 with teensyduino addon 1.18 and later.
Install in the usual way: unzip the distribution zip file to the libraries sub-folder of your sketchbook.
This code uses speed calculations as described in "Generate stepper-motor speed profiles in real time" by David Austin http://fab.cba.mit.edu/classes/MIT/961.09/projects/i0/Stepper_Motor_Speed_Profile.pdf or http://www.embedded.com/design/mcus-processors-and-socs/4006438/Generate-stepper-motor-speed-profiles-in-real-time or http://web.archive.org/web/20140705143928/http://fab.cba.mit.edu/classes/MIT/961.09/projects/i0/Stepper_Motor_Speed_Profile.pdf with the exception that AccelStepper uses steps per second rather than radians per second (because we dont know the step angle of the motor) An initial step interval is calculated for the first step, based on the desired acceleration On subsequent steps, shorter step intervals are calculated based on the previous step until max speed is achieved.
+This code uses speed calculations as described in "Generate stepper-motor speed profiles in real time" by David Austin http://fab.cba.mit.edu/classes/MIT/961.09/projects/i0/Stepper_Motor_Speed_Profile.pdf or http://www.embedded.com/design/mcus-processors-and-socs/4006438/Generate-stepper-motor-speed-profiles-in-real-time or http://web.archive.org/web/20140705143928/http://fab.cba.mit.edu/classes/MIT/961.09/projects/i0/Stepper_Motor_Speed_Profile.pdf with the exception that AccelStepper uses steps per second rather than radians per second (because we dont know the step angle of the motor) An initial step interval is calculated for the first step, based on the desired acceleration On subsequent steps, shorter step intervals are calculated based on the previous step until max speed is achieved.
The included examples AFMotor_* are for Adafruit Motor Shield V1 and do not work with Adafruit Motor Shield V2. See https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library for examples that work with Adafruit Motor Shield V2.
This library is offered under a free GPL license for those who want to use it that way. We try hard to keep it up to date, fix bugs and to provide free support. If this library has helped you save time or money, please consider donating at http://www.airspayce.com or here:
AccelStepper is a trademark of AirSpayce Pty Ltd. The AccelStepper mark was first used on April 26 2010 for international trade, and is used only in relation to motor control hardware and software. It is not to be confused with any other similar marks covering other goods and services.
+AccelStepper is a trademark of AirSpayce Pty Ltd. The AccelStepper mark was first used on April 26 2010 for international trade, and is used only in relation to motor control hardware and software. It is not to be confused with any other similar marks covering other goods and services.
This software is Copyright (C) 2010-2018 Mike McCauley. Use is subject to license conditions. The main licensing options available are GPL V3 or Commercial:
+This software is Copyright (C) 2010-2021 Mike McCauley. Use is subject to license conditions. The main licensing options available are GPL V3 or Commercial:
- 1.8.13
+Generated by