This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add appropriate license files and complete dist
- Loading branch information
Lou Amadio
committed
Oct 26, 2015
1 parent
3fba7fe
commit 4864123
Showing
35 changed files
with
5,473 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This software is Copyright (C) 2008 Mike McCauley. Use is subject to license | ||
conditions. The main licensing options available are GPL V2 or Commercial: | ||
|
||
Open Source Licensing GPL V2 | ||
|
||
This is the appropriate option if you want to share the source code of your | ||
application with everyone you distribute it to, and you also want to give them | ||
the right to share who uses it. If you wish to use this software under Open | ||
Source Licensing, you must contribute all your source code to the open source | ||
community in accordance with the GPL Version 2 when your application is | ||
distributed. See http://www.gnu.org/copyleft/gpl.html | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
AccelStepper/Makefile | ||
AccelStepper/AccelStepper.h | ||
AccelStepper/AccelStepper.cpp | ||
AccelStepper/MultiStepper.h | ||
AccelStepper/MultiStepper.cpp | ||
AccelStepper/MANIFEST | ||
AccelStepper/LICENSE | ||
AccelStepper/project.cfg | ||
AccelStepper/keywords.txt | ||
AccelStepper/doc | ||
AccelStepper/examples/Blocking/Blocking.pde | ||
AccelStepper/examples/MultipleSteppers/MultipleSteppers.pde | ||
AccelStepper/examples/Overshoot/Overshoot.pde | ||
AccelStepper/examples/ConstantSpeed/ConstantSpeed.pde | ||
AccelStepper/examples/Random/Random.pde | ||
AccelStepper/examples/AFMotor_ConstantSpeed/AFMotor_ConstantSpeed.pde | ||
AccelStepper/examples/AFMotor_MultiStepper/AFMotor_MultiStepper.pde | ||
AccelStepper/examples/ProportionalControl/ProportionalControl.pde | ||
AccelStepper/examples/Bounce/Bounce.pde | ||
AccelStepper/examples/Quickstop/Quickstop.pde | ||
AccelStepper/examples/MotorShield/MotorShield.pde | ||
AccelStepper/examples/DualMotorShield/DualMotorShield.pde | ||
AccelStepper/examples/MultiStepper/MultiStepper.pde | ||
AccelStepper/doc | ||
AccelStepper/doc/index.html | ||
AccelStepper/doc/functions.html | ||
AccelStepper/doc/annotated.html | ||
AccelStepper/doc/tab_l.gif | ||
AccelStepper/doc/tabs.css | ||
AccelStepper/doc/files.html | ||
AccelStepper/doc/classAccelStepper-members.html | ||
AccelStepper/doc/doxygen.css | ||
AccelStepper/doc/AccelStepper_8h-source.html | ||
AccelStepper/doc/tab_r.gif | ||
AccelStepper/doc/doxygen.png | ||
AccelStepper/doc/tab_b.gif | ||
AccelStepper/doc/functions_func.html | ||
AccelStepper/doc/classAccelStepper.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Makefile | ||
# | ||
# Makefile for the Arduino AccelStepper project | ||
# | ||
# Author: Mike McCauley (mikem@airspayce.com) | ||
# Copyright (C) 2010 Mike McCauley | ||
# $Id: Makefile,v 1.5 2015/08/25 02:22:45 mikem Exp mikem $ | ||
|
||
PROJNAME = AccelStepper | ||
VERSION_MAJOR = 1 | ||
VERSION_MINOR = 48 | ||
|
||
DISTFILE = $(PROJNAME)-$(VERSION_MAJOR).$(VERSION_MINOR).zip | ||
|
||
all: versioning doxygen dist upload | ||
|
||
versioning: | ||
sed -i.bak -e 's/AccelStepper-.*\.zip/$(DISTFILE)/' AccelStepper.h | ||
|
||
doxygen: | ||
doxygen project.cfg | ||
|
||
ci: | ||
(cd ..;ci -l `cat $(PROJNAME)/MANIFEST`) | ||
|
||
dist: | ||
(cd ..; zip $(PROJNAME)/$(DISTFILE) `cat $(PROJNAME)/MANIFEST`) | ||
|
||
upload: | ||
rsync -avz $(DISTFILE) doc/ www.airspayce.com:public_html/mikem/arduino/$(PROJNAME) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// MultiStepper.cpp | ||
// | ||
// Copyright (C) 2015 Mike McCauley | ||
// $Id: $ | ||
|
||
#include "MultiStepper.h" | ||
#include "AccelStepper.h" | ||
|
||
MultiStepper::MultiStepper() | ||
: _num_steppers(0) | ||
{ | ||
} | ||
|
||
boolean MultiStepper::addStepper(AccelStepper& stepper) | ||
{ | ||
if (_num_steppers >= MULTISTEPPER_MAX_STEPPERS) | ||
return false; // No room for more | ||
_steppers[_num_steppers++] = &stepper; | ||
} | ||
|
||
void MultiStepper::moveTo(long absolute[]) | ||
{ | ||
// First find the stepper that will take the longest time to move | ||
float longestTime = 0.0; | ||
|
||
uint8_t i; | ||
for (i = 0; i < _num_steppers; i++) | ||
{ | ||
long thisDistance = absolute[i] - _steppers[i]->currentPosition(); | ||
float thisTime = abs(thisDistance) / _steppers[i]->maxSpeed(); | ||
|
||
if (thisTime > longestTime) | ||
longestTime = thisTime; | ||
} | ||
|
||
if (longestTime > 0.0) | ||
{ | ||
// Now work out a new max speed for each stepper so they will all | ||
// arrived at the same time of longestTime at the same time | ||
for (i = 0; i < _num_steppers; i++) | ||
{ | ||
long thisDistance = absolute[i] - _steppers[i]->currentPosition(); | ||
float thisSpeed = thisDistance / longestTime; | ||
_steppers[i]->moveTo(absolute[i]); // New target position (resets speed) | ||
_steppers[i]->setSpeed(thisSpeed); // New speed | ||
} | ||
} | ||
} | ||
|
||
// Returns true if any motor is still running to the target position. | ||
boolean MultiStepper::run() | ||
{ | ||
uint8_t i; | ||
boolean ret = false; | ||
for (i = 0; i < _num_steppers; i++) | ||
{ | ||
if ( _steppers[i]->distanceToGo() != 0) | ||
{ | ||
_steppers[i]->runSpeed(); | ||
ret = true; | ||
} | ||
} | ||
return ret; | ||
} | ||
|
||
// Blocks until all steppers reach their target position and are stopped | ||
void MultiStepper::runSpeedToPosition() | ||
{ | ||
while (run()) | ||
; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// MultiStepper.h | ||
|
||
#ifndef MultiStepper_h | ||
#define MultiStepper_h | ||
|
||
#include <stdlib.h> | ||
#if ARDUINO >= 100 | ||
#include <Arduino.h> | ||
#else | ||
#include <WProgram.h> | ||
#include <wiring.h> | ||
#endif | ||
|
||
#define MULTISTEPPER_MAX_STEPPERS 10 | ||
|
||
class AccelStepper; | ||
|
||
///////////////////////////////////////////////////////////////////// | ||
/// \class MultiStepper MultiStepper.h <MultiStepper.h> | ||
/// \brief Operate multiple AccelSteppers in a co-ordinated fashion | ||
/// | ||
/// This class can manage multiple AccelSteppers (up to MULTISTEPPER_MAX_STEPPERS = 10), | ||
/// and cause them all to move | ||
/// to selected positions at such a (constant) speed that they all arrive at their | ||
/// target position at the same time. This can be used to support devices with multiple steppers | ||
/// on say multiple axes to cause linear diagonal motion. Suitable for use with X-Y plotters, flatbeds etc | ||
/// to get linear straight line movement between arbitrary 2d (or 3d or ...) positions. | ||
/// | ||
/// Caution: only constant speed stepper motion is supported: acceleration and deceleration is not supported | ||
/// All the steppers managed by MultiStepper will step at a constant speed to their | ||
/// target (albeit perhaps different speeds for each stepper). | ||
class MultiStepper | ||
{ | ||
public: | ||
/// Constructor | ||
MultiStepper(); | ||
|
||
/// Add a stepper to the set of managed steppers | ||
/// There is an upper limit of MULTISTEPPER_MAX_STEPPERS = 10 to the number of steppers that can be managed | ||
/// \param[in] stepper Reference to a stepper to add to the managed list | ||
/// \return true if successful. false if the number of managed steppers would exceed MULTISTEPPER_MAX_STEPPERS | ||
boolean addStepper(AccelStepper& stepper); | ||
|
||
/// Set the target positions of all managed steppers | ||
/// according to a coordinate array. | ||
/// New speeds will be computed for each stepper so they will all arrive at their | ||
/// respective targets at very close to the same time. | ||
/// \param[in] absolute An array of desired absolute stepper positions. absolute[0] will be used to set | ||
/// the absolute position of the first stepper added by addStepper() etc. | ||
void moveTo(long absolute[]); | ||
|
||
/// Calls runSpeed() on all the managed steppers | ||
/// that have not acheived their target position. | ||
/// \return true if any stepper is still in the process of running to its target position. | ||
boolean run(); | ||
|
||
/// Runs all managed steppers until they acheived their target position. | ||
/// Blocks until all that position is acheived. | ||
void runSpeedToPosition(); | ||
|
||
private: | ||
// Array of pointers to the steppers we are controlling. | ||
// Fills from 0 onwards | ||
AccelStepper* _steppers[MULTISTEPPER_MAX_STEPPERS]; | ||
|
||
// Number of steppers we are controlling and the number | ||
// of steppers in _steppers[] | ||
uint8_t _num_steppers; | ||
}; | ||
|
||
/// @example MultiStepper.pde | ||
/// Use MultiStepper class to manage multiple steppers and make them all move to | ||
/// the same position at the same time for linear 2d (or 3d) motion. | ||
|
||
#endif |
Oops, something went wrong.