Stepper Motor Speed and Direction with one Potentiometer

Looking for the best way to control speed and direction of a stepper motor using 1 pot

Something like this ?

int potVal  = analogRead(potPin); // range 0-1023
potVal = potVal - 512; // range -512 to + 511
If (potVal < 0) {
  dirn = 'F';
}
else {
  dirn = 'R';
}
absPotVal = abs(potVal); // make sure it's positive
millisBetweenSteps = map(absPotVal, 0, 511, xx, mm) // xx = high value for slow speed, mm = low value for high speed

…R
Stepper Motor Basics
Simple Stepper Code

I am very new to this and really dont know anything yet. This is my first arduino project. we are using a 12v nema 17 and eventually a 12v 12Nm Nema 34 to drive our machine. We are using 12v power supply, arduino, motor and l298n driver. i am wanting to change direction and speed in real time with a single pot

potVal = potVal = 512; // range -512 to + 511

Typo perhaps?

Maybe this:
potVal = potVal - 512; // range -512 to + 511

CrossRoads:
potVal = potVal = 512; // range -512 to + 511

Typo perhaps?

Thanks for spotting that. I have corrected it.

...R

ampedimagery:
I am very new to this and really dont know anything yet.

Have you carefully considered Reply #1 - does it meet your need?

...R

This is my first arduino project.

Start with something simpler, like getting your stepper to work.

You need an Arduino, an appropriate motor power supply, wire the driver to the motor without using a breadboard (because the breadboard connectors will burn) and importantly, set the motor driver current limit properly. You will need a multimeter for that.