Stepper motor button control

looking for some help with controlling a stepper motor.

currently i am running the code below and it works fine. when i push a button the motor goes 6400 steps (1 full rev using the Big Easy Driver)

so when i push the button it executes "program"

i need the "program" to rotate 1 full rev and delay for an amount of time, repeat x# times at a button push

when i push the button
rotate 1 rev
stop 1 sec
rotate 1 rev
stop 1 sec
.
.
.

#define DISTANCE 6400

int StepCounter = 0;
int Stepping = false;

void setup() {                
  pinMode(8, OUTPUT);     
  pinMode(9, OUTPUT);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);

  pinMode(3,INPUT);
}

void loop() {
  if (digitalRead(3) == LOW && Stepping == false)
  {
    Stepping = true;
  }

  if (Stepping == true)
  {
    digitalWrite(9, HIGH);
    delayMicroseconds(100);          
    digitalWrite(9, LOW); 
    delayMicroseconds(100);

    StepCounter = StepCounter + 1;

    if (StepCounter == DISTANCE)
    {
      StepCounter = 0;
      Stepping = false;
      
     }
  }
}

This is not very elegant but it may meet your needs and it has required very little change to your code

void loop() {
  if (digitalRead(3) == LOW && Stepping == false)
  {
    runSequence = true;
  }
  
  if (runSequence == true) {
    for (n = 0; n < numMoves; n++) {
        if (Stepping == false) {
            stepping = true;
            moveMotor();
        }
    }
    runSequence = false;
  }
  
}

void moveMotor() {
  if (Stepping == true)
  {
    digitalWrite(9, HIGH);
    delayMicroseconds(100);         
    digitalWrite(9, LOW);
    delayMicroseconds(100);

    StepCounter = StepCounter + 1;

    if (StepCounter == DISTANCE)
    {
      StepCounter = 0;
      Stepping = false;
      delay(delayPeriod);
     
     }
  }
}

...R

thanks a lot!

a couple of things

runSequence
moveMotor
n

are not defined?

moveMotor() should be. Check that all the {} are properly paired.

You have to create a variable called runSequence.

And I made a mistake - this is how the line should be

for (byte n = 0; n < numMoves; n++) {

If that does not solve the problem post the actual code that you are trying to compile.

...R