Skip to content

Commit

Permalink
Transfer from bildr.code
Browse files Browse the repository at this point in the history
  • Loading branch information
ameyer committed May 3, 2017
0 parents commit 61acba2
Show file tree
Hide file tree
Showing 8 changed files with 1,123 additions and 0 deletions.
501 changes: 501 additions & 0 deletions AccelStepper/AccelStepper.cpp

Large diffs are not rendered by default.

455 changes: 455 additions & 0 deletions AccelStepper/AccelStepper.h

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions AccelStepper/LICENSE
@@ -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.
37 changes: 37 additions & 0 deletions AccelStepper/keywords.txt
@@ -0,0 +1,37 @@
#######################################
# Syntax Coloring Map For AccelStepper
#######################################

#######################################
# Datatypes (KEYWORD1)
#######################################

AccelStepper KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
#######################################

moveTo KEYWORD2
move KEYWORD2
run KEYWORD2
runSpeed KEYWORD2
setMaxSpeed KEYWORD2
setAcceleration KEYWORD2
setSpeed KEYWORD2
speed KEYWORD2
distanceToGo KEYWORD2
targetPosition KEYWORD2
currentPosition KEYWORD2
steCurrentPosition KEYWORD2
runToPosition KEYWORD2
runSpeedToPosition KEYWORD2
runToNewPosition KEYWORD2
disableOutputs KEYWORD2
enableOutputs KEYWORD2
setMinPulseWidth KEYWORD2

#######################################
# Constants (LITERAL1)
#######################################

19 changes: 19 additions & 0 deletions License.txt
@@ -0,0 +1,19 @@
Copyright (c) 2010 bildr community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Empty file added Read_Me.txt
Empty file.
39 changes: 39 additions & 0 deletions one_stepper_example.ino
@@ -0,0 +1,39 @@
//This is an example of how you would control 1 stepper

#include <AccelStepper.h>

int motorSpeed = 9600; //maximum steps per second (about 3rps / at 16 microsteps)
int motorAccel = 80000; //steps/second/second to accelerate

int motorDirPin = 2; //digital pin 2
int motorStepPin = 3; //digital pin 3

//set up the accelStepper intance
//the "1" tells it we are using a driver
AccelStepper stepper(1, motorStepPin, motorDirPin);



void setup(){
stepper.setMaxSpeed(motorSpeed);
stepper.setSpeed(motorSpeed);
stepper.setAcceleration(motorAccel);

stepper.moveTo(32000); //move 32000 steps (should be 10 rev)
}

void loop(){

//if stepper is at desired location
if (stepper.distanceToGo() == 0){
//go the other way the same amount of steps
//so if current position is 400 steps out, go position -400
stepper.moveTo(-stepper.currentPosition());
}



//these must be called as often as possible to ensure smooth operation
//any delay will cause jerky motion
stepper.run();
}
55 changes: 55 additions & 0 deletions two_steppers.ino
@@ -0,0 +1,55 @@
//This is an example of how you would control 2 steppers at the same time

#include <AccelStepper.h>

int motorSpeed = 9600; //maximum steps per second (about 3rps / at 16 microsteps)
int motorAccel = 80000; //steps/second/second to accelerate

int motor1DirPin = 2; //digital pin 2
int motor1StepPin = 3; //digital pin 3

int motor2DirPin = 4; //digital pin 4
int motor2StepPin = 5; //digital pin 5

//set up the accelStepper intances
//the "1" tells it we are using a driver
AccelStepper stepper1(1, motor1StepPin, motor1DirPin);
AccelStepper stepper2(1, motor2StepPin, motor2DirPin);


void setup(){
stepper1.setMaxSpeed(motorSpeed);
stepper2.setMaxSpeed(motorSpeed);

stepper1.setSpeed(motorSpeed);
stepper2.setSpeed(motorSpeed);

stepper1.setAcceleration(motorAccel);
stepper2.setAcceleration(motorAccel);

stepper1.moveTo(32000); //move 32000 steps (should be 10 rev)
stepper2.moveTo(15000); //move 15000 steps
}

void loop(){

//if stepper1 is at desired location
if (stepper1.distanceToGo() == 0){
//go the other way the same amount of steps
//so if current position is 400 steps out, go position -400
stepper1.moveTo(-stepper1.currentPosition());
}

//if stepper2 is at desired location
if (stepper2.distanceToGo() == 0){
//go the other way the same amount of steps
//so if current position is 400 steps out, go position -400
stepper2.moveTo(-stepper2.currentPosition());
}


//these must be called as often as possible to ensure smooth operation
//any delay will cause jerky motion
stepper1.run();
stepper2.run();
}

0 comments on commit 61acba2

Please sign in to comment.