Need help w/manual stepper control sketch(noob)

Hello All,
I think I bit off more than I can chew. I have a small hobby machine shop in my house. My main hobby is pinball machine restoration but I dabble in many things. In my machine shop I have a x2 mini mill. I’d like to add a power feed to my mill. I can buy one but reviews on store bought units are poor at best. I decided to build one. I’m no stranger to electronics but programing and I have never met. We are complete strangers and he is not as friendly as I’d hoped. What I have so far is a working prototype. An authentic Arduino uno, big Easydriver, 2amp 0-30v 6 wire nema 23 stepper motor. A 5v wall wart to power the uno and a 12v laptop power supply going to the big Easydriver. Once I get this working I’ll buy a bigger power supply if needed. I don’t need super fast speeds. In fact slower smooth speeds will probably be more important. So far I have it up and running with example #5 from this page,
http://www.schmalzhaus.com/EasyDriver/Examples/EasyDriverExamples.html
One button for left, one for right, a stop and a pot for speed control. It’s not exactly what I planned but it will do fine. Originally I wanted it to work more like this one,
http://littlemachineshop.com/products/product_view.php?ProductID=2376
They are very close as you can see.
I was hoping to just figure out the programming but that’s not happening. I’ve started watching the open source channel on YouTube in an attempt to learn. It’s going but it’s going slow. I’m hoping someone could help me finish this project up so I can move on to something more basic to learn on. If I could get this sketch optimized to work well with my application I’d be happy. I’ve tried to fiddle with the speeds but every time I change something it acts screwy. Id like to get it done, stick it in a box, couple it to my mill and move on to a more basic learning project.

Couple questions,
What can be don’t to make this better for my application?
Can I use a toggle switch to replace the left and right buttons?
Why do the L,R and stop buttons act differently when I try to change the min and max speeds?
I changed them from 0.1 & 500 to 500 & 1000. After the change the left button was a faster left, stop was a slow left and right was a slow right.

// Example5 code for Brian Schmalz's Easy Driver Example page
// http://www.schmalzhaus.com/EasyDriver/EasyDriverExamples.html

#include <AccelStepper.h>

// Define the stepper and the pins it will use
AccelStepper stepper1(1, 9, 8);

// Define our three input button pins
#define  LEFT_PIN  4
#define  STOP_PIN  3
#define  RIGHT_PIN 2

// Define our analog pot input pin
#define  SPEED_PIN 0

// Define our maximum and minimum speed in steps per second (scale pot to these)
#define  MAX_SPEED 500
#define  MIN_SPEED 0.1

void setup() {
  // The only AccelStepper value we have to set here is the max speeed, which is higher than we'll ever go 
  stepper1.setMaxSpeed(10000.0);
  
  // Set up the three button inputs, with pullups
  pinMode(LEFT_PIN, INPUT_PULLUP);
  pinMode(STOP_PIN, INPUT_PULLUP);
  pinMode(RIGHT_PIN, INPUT_PULLUP);
}

void loop() {
  static float current_speed = 0.0;         // Holds current motor speed in steps/second
  static int analog_read_counter = 1000;    // Counts down to 0 to fire analog read
  static char sign = 0;                     // Holds -1, 1 or 0 to turn the motor on/off and control direction
  static int analog_value = 0;              // Holds raw analog value.
  
  // If a switch is pushed down (low), set the sign value appropriately
  if (digitalRead(LEFT_PIN) == 0) {
    sign = 1;
  }
  else if (digitalRead(RIGHT_PIN) == 0) {    
    sign = -1;
  }
  else if (digitalRead(STOP_PIN) == 0) {
    sign = 0;
  }

  // We only want to read the pot every so often (because it takes a long time we don't
  // want to do it every time through the main loop).  
  if (analog_read_counter > 0) {
    analog_read_counter--;
  }
  else {
    analog_read_counter = 3000;
    // Now read the pot (from 0 to 1023)
    analog_value = analogRead(SPEED_PIN);
    // Give the stepper a chance to step if it needs to
    stepper1.runSpeed();
    //  And scale the pot's value from min to max speeds
    current_speed = sign * ((analog_value/1023.0) * (MAX_SPEED - MIN_SPEED)) + MIN_SPEED;
    // Update the stepper to run at this new speed
    stepper1.setSpeed(current_speed);
  }

  // This will run the stepper at a constant speed
  stepper1.runSpeed();
}

We are complete strangers and he is not as friendly as I'd hoped.

Was your first encounter with a machine tool friendly? I doubt it. But, you learned to tame the beast. Don't let programming scare you any more than the first machine tool did.

Mini Mill Power Feed Kit, No Feed Screw CLOSEOUT 2376 - LittleMachineShop.com

That link shows a power feed kit, but I don't see it being used to do anthing.

They are very close as you can see.

No, I can't.

If I could get this sketch optimized to work well with my application I'd be happy.

If we knew what the code actually does, and what you want it to do/not do/do differently, we could help.

I've tried to fiddle with the speeds but every time I change something it acts screwy

We can't see how you've "fiddled with the speeds" or what "acts screwy" means.

What can be don't to make this better for my application?

You have not defined what it does, or what "better" means.

Can I use a toggle switch to replace the left and right buttons?

You can use any kind of switch you like. What happens when a switch is read is far more important than the kind of switch is making electricity flow, or not flow.

Why do the L,R and stop buttons act differently when I try to change the min and max speeds?

You need to explain how the switches are actually wired, and what the different behaviors are.

PaulS:
Was your first encounter with a machine tool friendly? I doubt it. But, you learned to tame the beast. Don't let programming scare you any more than the first machine tool did.

I'm not scared. When I decide I want to learn something I do. It's just not happening as fast as I'd like. I need to finish this up so I can clear off the bench and start on something more pressing.

"That link shows a power feed kit, but I don't see it being used to do anthing."

It simply moved the table on the millimg machine left and right. There's one button for power, a toggle switch for left and right and a pot for speed control

"If we knew what the code actually does, and what you want it to do/not do/do differently, we could help."

The code manually controls a stepper motor. There is a pot for speed control and three buttons. One button for left, one for right and a stop button.

"We can't see how you've "fiddled with the speeds" or what "acts screwy" means."

In my origional post I talk about trying to change the min/max speeds. And how it changed the way the buttons act.

"You can use any kind of switch you like. What happens when a switch is read is far more important than the kind of switch is making electricity flow, or not flow.
You need to explain how the switches are actually wired, and what the different behaviors are."

I'll post the diagram from the same page I found the code in a few min.
When running this code I find i don't have a very good range of speeds. I'd like to change that. I'd like to be able to play with the speeds to find out what works best. So far just changing the min/max speeds didn't do anything good as explained above.
Right now I have three momentary push button switches. Left, right and stop. Can u use a three pole toggle switch or does it have to be a momentary switch?
From what I read the big easy driver is default to 1/16 steep. How do I change this? I'd like to see what works best once I get it hooked up to the mill.

I would change the code so it only reads the potentiometer occasionally but it updates the speed value every iteration of loop. That way it catches changes to your buttons immediately.

Move this line

   current_speed = sign * ((analog_value/1023.0) * (MAX_SPEED - MIN_SPEED)) + MIN_SPEED;

to be the second last line.

It would be better to use a time-based decision for reading the potentiometer. See how millis() is used to manage timing in several things at a time

...R
Stepper Motor Basics