Controlling 4 Stepper Motors with 2 Joystick, a4988 Motor Driver, and Arduino Uno (without CNC shield)

Hi, I am a noob trying to connect 4 stepper motors with 2 joysticks (using arduino uno and a4988) for a personal project, I have made the schematics and code on wokwi, and so far I can control the 3 stepper motors with the 2 joysticks, however, the fourth one won't rotate, suggestions are most welcomed!

Since you have a lot of copy and paste going on, I expect that you missed an edit somewhere.

Is it actually the last motor that falls?

Add some serial prints for debugging. Also try moving the bad motor to pins that were working - does the problem move too?

really nice suggestion, I didn't think of doing that! I have debugged the "speed" variable which is the input to my .setSpeed function, and they all worked without problem, the value oscillates between -500 until 500, even the one with the input "A3", I might be thinking that this has something to do with lack of power input or maybe wrong dir and step pin placement for the 4th motor (8, 9), any other solutions?

Yeah, you didn't set MaxSpeed for stepper 4:

  stepper3.setMaxSpeed(500);
  stepper3.setMaxSpeed(500);

You should think about arrays instead of using copy/paste :thinking: :wink:

A 'quick&dirty' change to arrays :wink: :

Thank you very much, the array and for loop method is simply genius!

You're welcome.