Here is an adaptation of the basic example from the library modified to run 3 steppers. I do not have your exact hardware but tested, successfully, with my Uno, CNC shield with
DRC8825 drivers (3) and NEMA17 steppers (3).
#include <ContinuousStepper.h>
// If using a stepper driver, with STEP and DIR pins:
ContinuousStepper<StepperDriver> stepperX;
ContinuousStepper<StepperDriver> stepperY;
ContinuousStepper<StepperDriver> stepperZ;
void setup()
{
// If using a stepper driver, with STEP and DIR pins
stepperX.begin(/*step=*/2, /*dir=*/5);
stepperY.begin(/*step=*/3, /*dir=*/6);
stepperZ.begin(/*step=*/4, /*dir=*/7);
stepperX.spin(600);
stepperY.spin(200);
stepperZ.spin(-400);
}
void loop()
{
stepperX.loop();
stepperY.loop();
stepperZ.loop();
}
If your motors do not work with this, proven, code then you probably have a hardware problem. Post a detailed schematic or wiring diagram. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies. And some photos of the wiring.
Thank you so much. I need to start and stop the stepper only if i have a button pressed from PLC. I am using settimino.h library to communicate and to send data from plc to arduino and vice versa.
If Button == 1 (button is pressed on HMI) then stepper 1 starts and if Button == 0 stepper 1 stops. Same for stepper2 and stepper3. Can you adapt this to the code?
No because your information is too unspecific to be able to adapt this.
With the code provided by groundfungus you got a starting point.
It is up to you to develop the code further from this point.
Without modifying the code through you yourself I have the impression you are asking for cost-free solutions with minimised own effort.
I don't know anything about PLC. What is HMI? How does the PLC communicate with the Arduino Uno? There is a lot of necessary information missing. So, please, start with a schematic and answer the questions above.
This is not a free code writing service. I can help you with code for Arduino, but the PLC stuff is out of scope for the Arduino forum.
I am communicating with settimino library. Communication is ok. HMI is human machine inrerface, a display which help me to control the system. I press a button in hmi, it sents 1 to arduino and when Button = 1 i want stepper 1 to work and when is 0 to not. Same for stepper2 and 3 with different buttona.
I just need help only in arduono code, in plc all is ok.
Its like i have a push button and if is pressed, stepper works and if is not pressed, stepper not working. Can you help me to adapt the code like this? Thank you so much