I am currently working on a project that require the use of stepper motor. The stepper motor i am using 5V Stepper Motor w/ULN2003 Driver , and a limit switch Micro Limit Switch – Future Electronics Egypt , is connected to the arduino uno. The stepper motor will rotate when the limit switch is off and stop when the limit switch is on. This is to set the home position. But there is something wrong with the coding i wrote and require some guidance. Really appreciate the help! Thanks!!
Sorry for the late reply due to my exam period. When i run the code into the arduino, pin 2 and pin 4 LED were lighted up on the driver but the stepper motor did not rotate at all. when the limit switch is pressed, pin 2 and pin 4 lights went off which went according to plan.
The stepper motor suppose to rotate when the pin 2 and pin 4 are lighted up on the driver and stop rotating once the limit switch is pressed where the pin 2 and pin 4 lights will go off.
May i know what is the problem with my code? Is there an alternative to it?