Below is my code and wiring. I am able to rotate my stepper motor constantly in either direction. What I want to do in my code is - just turn it one rotation clockwise and then one rotation counter clock wise. That's it.
void setup() {
pinMode(2, OUTPUT); //pin 2 is for direction
pinMode(3, OUTPUT); //pin3 is control signal
}
void loop() {
digitalWrite(3, HIGH);
digitalWrite(3, LOW);
delayMicroseconds(100);
}
If this is a diy, you will have to determine the the step angle of the motor, 1.8॰ or 0.9॰ ... the steps/rotation of one will be twice that of the other... There is lower available torque with a smaller step rate...
This also controls current to the drive motor... Ensure it's set properly for your motor.