Stepper Motor Clockwise and then Counterclockwise

I have issues about the stepper motor, is it possible to program the motor to run a certain time clockwise and then after that it will run again at the same time counterclockwise? i’m not good at programming and I really need help. thanks ! I hope for your replies

Lots of things are possible with stepper motors.

Are you planning on using some type of motor shield? (almost mandatory for unipolar motors) Are you planning on connecting transistors/MOSFETs to the Arduino pins? (works just fine for bipolar motors) Are you planning on using some type of driver board? (only 2 outputs from the Arduino - Step & Direction) Are you wanting to go for some time, or some distance? How fast do you want to turn? One speed or several speeds? How long does it need to run? Do you need it to return to some starting point?

here's some code I was working on for a stepper driver - the function for the motor will work either as an interrupt function or as a called function -,84809.0.html

I simply want to use the stepper motor as a pusher .. ill integrate a mechanism that will serve as a pusher .. it will just go forward and then goes back to its original position whenever a button is pressed, it will just run at small rpm.

Just treat it like an LED, that is make it flash / step the motor. A simple for loop will allow you to step in one direction. Then change the direction pin on the driver and repeat that loop.

Still the question remains - What type of motor - Unipolar or Bipolar? That will determine what you need to “drive” the motor. discrete transistors/MOSFETs or 2 H-Bridges, or are you going to use a dedicated driver? The next question is How Fast? and the next is How many steps?

Controlling a stepper is just a matter of supplying current to the windings in the proper sequence and the motor will step. It can be done using digitalWrite() or using direct port manipulation. Direct port manipulation is a bit faster, but it is a bit harder to program.

Without hardware all we can really reply is YES, Arduino and a stepper are capable of doing this type of operation.