Hello there, it's my first post and I hope I post in the right place ![]()
I'm new to Arduino and I'm trying to build a project where with the Arduino MEGA I'll control 2 Motors, a Stepper Motor NEMA 17 and a DC Motor. The concept is, that by choosing one of 4 options on my LCD screen (A,B,C or D) the Motors with move accordingly. For example if I pick option A, there has to be this sequence: Stepper Motor moves 50 steps, waits 5 seconds, then the DC Motor moves for 3 seconds, waits 5 seconds, then the DC Motor moves the other direction, waits 5 seconds. That's one cycle, and for option A I need this to repeat for 4 times.
No matter what I've tried, it doesn't seem to work, I use L298N driver for both motors, when I try simplier codes like only the Stepper moving or only the DC Motor moving it works fine. So I guess I do something damn wrong with the code
I even used ChatGPT but I can't find a solution, in every code I try the motions are mixed, sometimes the DC Motor doesn't do the movements, I need some help here.
So to recap, I just need some help for option A, and I'll figure out how to make the rest. The motors have to move like that:
User clicks A from Keyboard.
Stepper Motor moves 50 steps.
Pause in the system for 5 seconds.
The DC Motor moves for 3 seconds.
Pause for 5 seconds.
The DC Motor moves for 3 seconds in the opposite direction.
Pause for 5 seconds.
Stepper Motor moves 50 steps.
Pause in the system for 5 seconds.
The DC Motor moves for 3 seconds.
Pause for 5 seconds.
The DC Motor moves for 3 seconds in the opposite direction.
Pause for 5 seconds.
In the end the Stepper Motor has to move back 100 steps so it's back to it's original place.
Thanks in advance if someone finds a way to help, I wish I posted on the right place, God bless you all guys ![]()


