Hi guys, i'm having some issues and for the life of me i can't figure out why...
I have the following code running on an Arduino Uno with no issues outputting to a ULN2003 board:
//Copyright 2012 Igor Campos
//
//This file is part of CustomStepper.
//
//CustomStepper is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//CustomStepper is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with CustomStepper. If not, see <http://www.gnu.org/licenses/>.
#include <CustomStepper.h>
//Full constructor, just the first 4 parameters are necessary, they are the pins connected to the motor,
//the others are optional, and default to the following below
//the 5th paramater is the steps sequence, where the 1st element of the array is the number of steps
//it can have a maximum of 8 steps
//the 6th parameter is the SPR (Steps Per Rotation)
//the 7th parameter is the RPM
//the 8th parameter is the rotation orientation
CustomStepper stepper(8, 9, 10, 11, (byte[]){8, B1000, B1100, B0100, B0110, B0010, B0011, B0001, B1001}, 4075.7728395, 12, CW);
boolean rotate1 = false;
boolean rotatedeg = true;//false
boolean crotate = false;//false
void setup()
{
Serial.begin(9600);
//sets the RPM
stepper.setRPM(1);
//sets the Steps Per Rotation, in this case it is 64 * the 283712/4455 annoying ger ratio
//for my motor (it works with float to be able to deal with these non-integer gear ratios)
stepper.setSPR(4075.7728395);
}
void loop()
{
if (stepper.isDone() && rotatedeg == true && crotate == false)
{
stepper.setDirection(CW);
//this will rotate until you stop it with another comand or set the direction to STOP
stepper.rotate();
crotate = true;
}
//this is very important and must be placed in your loop, it is this that makes the motor steps
//when necessary
stepper.run();
}
However when i try to change the micro to a Teensy2 with the following code i get no movement at all, pins allocated are 11,12,13,14.
//Copyright 2012 Igor Campos
//
//This file is part of CustomStepper.
//
//CustomStepper is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//CustomStepper is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with CustomStepper. If not, see <http://www.gnu.org/licenses/>.
#include <CustomStepper.h>
//Full constructor, just the first 4 parameters are necessary, they are the pins connected to the motor,
//the others are optional, and default to the following below
//the 5th paramater is the steps sequence, where the 1st element of the array is the number of steps
//it can have a maximum of 8 steps
//the 6th parameter is the SPR (Steps Per Rotation)
//the 7th parameter is the RPM
//the 8th parameter is the rotation orientation
CustomStepper stepper(11, 12, 13, 14, (byte[]){8, B1000, B1100, B0100, B0110, B0010, B0011, B0001, B1001}, 4075.7728395, 12, CW);
boolean rotate1 = false;
boolean rotatedeg = true;//false
boolean crotate = false;//false
void setup()
{
Serial.begin(9600);
//sets the RPM
stepper.setRPM(2);
//sets the Steps Per Rotation, in this case it is 64 * the 283712/4455 annoying ger ratio
//for my motor (it works with float to be able to deal with these non-integer gear ratios)
stepper.setSPR(4075.7728395);
}
void loop()
{
if (stepper.isDone() && rotatedeg == true && crotate == false)
{
stepper.setDirection(CW);
//this will rotate until you stop it with another comand or set the direction to STOP
stepper.rotate();
crotate = true;
}
//this is very important and must be placed in your loop, it is this that makes the motor steps
//when necessary
stepper.run();
}
This has to be something really simple that i'm missing but can't see what?!
Note the stepper is powered externally from the micro.
Your help would be much appreciated!
Thank you.