How move stepper 1 step when input signal is HIGH?

Hi, This is my very first topic here and I hope to get help,
I have a project where I am using Arduino UNO and a 28BYJ-48 stepper motor, I need to make the stepper motor moves 1 step (or more) when an external input signal becomes HIGH, regardless how long it stays HIGH. the signal will turn LOW after a while, in other words the stepper should moves same steps each time signal is HIGH.

I appreciate your help.

BasOnTech video about stepper motor: 28BYJ-48 STEPPER MOTOR WITH ULN2003 DRIVER - Arduino tutorial #14 - YouTube.
The video shows basic information, but you don't need that library.
The normal Arduino library is the Stepper library: Arduino - Stepper. There is even an example to make a single step.

Detect if a button is pressed (regardless how long it is pressed) is the State Change Detection: https://www.arduino.cc/en/Tutorial/BuiltInExamples/StateChangeDetection/.

Don't rush towards the end result. Test the stepper motor with a test-sketch. Make a separate test-sketch for the input signal. If you understand both, then you can combine them.

Check out the attachInterrupt() function.

https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/

It has the option to detect only when it signal goes HIGH.
That option is called "RISING".

Note:
If you use an input signal like a push button, be careful about bouncing.
Even if it looks like a single push to humans, the Arduino detect it as a multiple pushed.
Arduino is fast enough to make that possible.

Is the motor a 5 volt or 12 volt? How is the motor connected to the Arduino? How is the motor powered? Where does the external signal come from?

Koepel:
BasOnTech video about stepper motor: 28BYJ-48 STEPPER MOTOR WITH ULN2003 DRIVER - Arduino tutorial #14 - YouTube.
The video shows basic information, but you don't need that library.
The normal Arduino library is the Stepper library: Arduino - Stepper. There is even an example to make a single step.

Detect if a button is pressed (regardless how long it is pressed) is the State Change Detection: https://www.arduino.cc/en/Tutorial/BuiltInExamples/StateChangeDetection/.

Don't rush towards the end result. Test the stepper motor with a test-sketch. Make a separate test-sketch for the input signal. If you understand both, then you can combine them.

Thank you, I will check these links.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.