Neew help with input to output to run stepper motor

Hi
I need some guidance on the sketch below. I am trying to have a stepper motor move forward and backwards after pushing
a button.
Thanks Rmac

#include <buttons.h>
#include <AccelStepper.h>
#include <AFMotor.h>

/*
One switch stepper motor Program

Turns on and off digital pin connected to pin 5 as output when pressing pushbutton
(Park ) attached to digital pins 2

The circuit:

  • Not sure of Motor circut yet , but output from digital pins 5
  • pushbutton is attached to digital pin 2 +5V
  • 10K resistors attached to digital pins 2 from ground

*/

// constants won’t change. They’re used here to
// set pin numbers:

const int buttonPinPark = 2; //Setting Park button to Pin 2

int buttonStatePark = 0; //Setting Park button state to off

const int Pin1 = 5; // Pin output number

AF_Stepper motor(200, 2);

void setup() {
// initialize the pin as an output:
pinMode (Pin1,OUTPUT);

// initialize the pushbutton pin as an input:
pinMode(buttonPinPark, INPUT);

motor.setSpeed(10); // 10 rpm
}

void loop(){
// read the state of the Park pushbutton value:
{ buttonStatePark = digitalRead(buttonPinPark); //code for Park button

// check if the Park pushbutton is pressed.
// if it is, the buttonStatePark is HIGH:

if (buttonStatePark == HIGH) {
// Have output on pin 5 (5 volts:
digitalWrite (Pin1, HIGH);

??? (“Single coil steps”); Dont know what to do here
motor.step(200, FORWARD, SINGLE);
motor.step(200, BACKWARD, SINGLE);

buttonStatePark = digitalRead(buttonPinPark);
if (buttonStatePark == LOW)
digitalWrite(Pin1,LOW);

else {
// Set Pin1 Off:
digitalWrite(Pin1, LOW);
}

}
}
}

How is the switch wired? You are not using the internal pull-up resistor, so you need to have an external pull-up or pull-down resistor wired with the switch. The test for HIGH implies a pull-down resistor.

I need some guidance on the sketch below.

The circuit:
 * Not sure of Motor circut yet , but output from digital pins 5

You can't write code to drive a stepper motor until you ARE sure.

Some unsolicited advice. Put each { and } on its own line, and use Tools + Auto Format to format your code. Then, remove unneeded { and } and format again.

Look into debouncing your switches.

I have the switch wired from the 5 Volt supply on the shield to pin # 2 with a pull down resistor going to ground from the switch.