I am wanting to turn my motor in only one direction. Below is the code I am using. I took out the last two lines of the code expecting the motor to only turn one way, but it still does 2 revolutions cw and 2 revolutions ccw. Any suggestions on what I should add/delete?
#define stepPin 5
#define dirPin 2
void setup() {
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop() {
digitalWrite(dirPin, HIGH); //sets which direction shaft rotates
//makes 800 pulses for making 4 revolutions
for(int x = 0; x < 800; x++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(37500 );
digitalWrite(stepPin, LOW);
delayMicroseconds(37500);
}
}