Hey peeps, I'm very new to that topic but i have some questions
First of all, Let me tell you what im trying to do ,
I try to run 1 stepper motor with a button at the same time i would like to control another stepper motor with another button
During the time the first motor is ON, I would like to control the second motor independently(2 times or 3 times)
Here is the thing , I can not control my second motor while the first motor is moving. How can i do that ?
Any idea would be great ! Thanks in advance
I can not control my second motor while the first motor is moving.
That's because of how you have written your code but you did not post it so providing help is difficult.
Let me share it quickly then,
#include <Stepper.h>
const int stepsPerRevolution = 1600;
const int stepsPerRevolution1 = 1600;
Stepper myStepper(stepsPerRevolution, 5,6);
Stepper myStepper1(stepsPerRevolution1, 3,2);
void setup(void){
myStepper.setSpeed(120);
myStepper1.setSpeed(30);
pinMode(7, INPUT);
}
void loop(){
int buton = digitalRead(7);
if (buton == HIGH){
myStepper.step(1600);
myStepper1.step(14400); // Is there any trick to run the first stepper during that line ???
delay(200);
}
In your first post you mention two buttons but your code only has one. It might be a problem..
in the code, Yes there is one button but it does not matter if you have one or two, in anyway i am to wait until the stepper1 motor is stopped.
i can also add the second buton to the code but i can not do anything during stepper1 is moving.
Hi,
Example of two Steppers on one Arduino (LAST Example) ON THIS PAGE
The standard Stepper library is not really suited to running multiple motors independently. The AccelStepper library is much more suitable as it can operate motors without blocking.
...R
Stepper Motor Basics