M
M
Maly2021-05-22 18:47:26
Arduino
Maly, 2021-05-22 18:47:26

How to connect 3 stepper motors to arduino?

Ehh just do not kill my desire with criticism.
In short, I have 3 stepper motors, 3 drivers for an arduino uno stepper motor, a breadboard and wires for connection. I connected 2 stepper motors to arduino on gnd, 3.3v and gnd,5v. And to 4,5,6,7 and 8,9,10,11. But I also need to connect the 3rd driver and can this be done through a breadboard? (I am a repeating newbie).
Here is the code:

#include <CustomStepper.h>          
CustomStepper stepper1(4,5,6,7); 
CustomStepper stepper2(8,9,10,11);
int example1 = 1; 
int example2 = 1; 
void setup()
{ 
 
 stepper1.setRPM(16);   //Для первого двигателя это stepper1              
  stepper1.setSPR(4075.7728395);  
   stepper2.setRPM(16);          //И для второго это stepper2      
  stepper2.setSPR(4075.7728395);
}

void loop()
{
 if (stepper1.isDone() and example1 == 1)  
  {
    stepper1.setDirection(CW);        
    stepper1.rotate(1);                
  }
  stepper1.run(); 

       
 if (stepper2.isDone() and example2 == 1)  
  {
    stepper2.setDirection(CCW);        
    stepper2.rotate(1);                
  }
  stepper2.run();      



}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2021-05-22
@firedragon

motor shield

A
AntHTML, 2021-05-24
@anthtml

We connect the control lines of the drivers, for example, to 4,5,6,7 We
connect the power keys of the drivers, for example, to 8,9,10,11 We supply
Enable to power the desired driver and turn it
Well, just not everyone tossing and turning at the same time, always, they can , but judging by the presented code, this is not particularly required.

E
evgeniy_lm, 2021-05-24
@evgeniy_lm

It is not clear what motors you have (bipolar / unipolar), which drivers, respectively, the same is not clear.
In general, for UNO you need such a board , you can connect 4 motors to it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question