These wonderful little doohickies are set up as seen on attached JPG.
My code is as follows:
#include "Stepper.h"
#define STEPSTM 200
#define STEPSM 48
Stepper TumblerMotor(STEPSTM, 12, 13); //defining the Tumbler motor function and pins
//Stepper Motor1(STEPSM, 10, 11); //defining Motor one of three
long previousMillis = 0; // will store last time motor was updated
long delaytm = 10; // interval at which to spin (milliseconds)
void setup()
{
TumblerMotor.setSpeed(100); //Set the velocity of Tumblr Motor
// Motor1.setSpeed(50); //Set velocity of Motor 1
Serial.begin(9600); //Setting the speed for the serial reader
}
void loop()
{
unsigned long currentMillis = millis(); //current time in milliseconds
if(currentMillis < 10000)
{
TumblerMotor.step(100); //Steppity Step Step
}
/* if(currentMillis > 10000)
{
Motor1.step(100); //Steppity Step Step
}
*/
Serial.println(currentMillis);
}
What I want it to do: I would like 4 motors to be able to work, either one after another or simultaniously. The large motor will eventually spin until a certain time, and then the small ones will increment in their own way.
What happens: The first motor/driver goes off without a hitch, but does get hot after a while of leaving the Power Supply connected. As for the second motor, I have 3V and 12V at the second driver, but no signal to the STEP/DIR of the driver, followed by no movement. When I attached the small motor to the first driver (with the same code), it works, but the driver buzzes after it's little rotation session and the motor got quite a bit hotter than the larger one. I haven't gotten to the 3rd or 4th yet for obvious reasons. The commented out part is the stuff for the second motor that I feel should work, but does not.
I am currently in my first circuits class and have taken electricity/magnetism, so please feel free to explain your suggestions.
I am thinking I have a bad driver... The signal thats getting sent to the second driver STEP/DIR is 1V. 0V when I turn the little screw thing on the driver. Can anyone explain what that is? I couldn't find it in the datasheet, which I'm sure includes it.
It is interesting to note that your small stepper motors can take more current (400mA) than the big motor (330mA). I have some of those "big" ones, and A4988s myself.
I don't get this concept except for doing a delay without saying delay. I don't want to delay anything, I just want one to run after the other. If you could explain how it works for what I want to do, that would be very helpful.
BTW, The code I posted has two motors, but one is commented out.
Robin2:
Try this simple stepper code to test your motors and drivers - it does not use any library.
I am not familiar with the stepper library. If this line
TumblerMotor.step(100);
blocks until all the steps are complete it won't be appropriate.
When you are controlling 4 motors you will almost certainly want to mve them one step at a time so they can move together.
You may find some useful stuff in [stepper motor basics](http://forum.arduino.cc/index.php?topic=284828.0).
It is interesting to note that your small stepper motors can take more current (400mA) than the big motor (330mA). I have some of those "big" ones, and A4988s myself.
Finally, the code you posted has only one motor.
...R
jpierson4:
I don't get this concept except for doing a delay without saying delay.
What do you mean by "this concept"?
I was just saying the the mathematical way you are using millis() is not appropriate. You should use subtraction.
By the way, it can be useful to include a short quote so everyone knows what post you are referring to but please don't repeat an entire post as it just makes the Thread harder to follow.