#include <AccelStepper.h>
#include <LiquidCrystal_I2C.h>

#define dirPin 8
#define stepPin 9
#define enabPin 10
#define stepsPerRev  200
int mspeed = 600;

AccelStepper stepper(AccelStepper::DRIVER, stepPin, dirPin);

int time_old = 0;
#define I2C_ADDR 0x27
#define LCD_COLUMNS 16
#define LCD_LINES 2

LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);

#define potspeed A1
#define potrot A0
#define BUTTON_1 7

void setup() {

  pinMode(potspeed, INPUT);
  pinMode(BUTTON_1, INPUT);
  pinMode(potrot, INPUT);

  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  pinMode(enabPin, OUTPUT);

  digitalWrite(BUTTON_1, HIGH);
  digitalWrite(enabPin, LOW);

  lcd.init();
  lcd.backlight();
  delay(500);
  lcd.setCursor(0, 0);
  lcd.print("Howdy");
  lcd.setCursor(0, 1);
  lcd.print("Yall");
  delay(2000);
  lcd.clear();
  lcd.print("No Turns: ");
  lcd.setCursor(0, 1);
  lcd.print("Speed (%): ");

  stepper.setMaxSpeed(mspeed);
  stepper.setAcceleration(100);
  stepper.setSpeed(50);

  Serial.begin(9600);

}
void loop() {
  int myTime = millis();
  int PotA = analogRead(potspeed);
  int PotB = analogRead(potrot);
  int bps = digitalRead(BUTTON_1);

  int NoRot = map(PotB, 0, 1023, 1, 20);
  int userspeed = map(PotA, 0, 1023, 10, 100);
  int speed = map(PotA, 0, 1023, 60, mspeed);
  int steps = NoRot * stepsPerRev;

  lcd.setCursor(11, 0);
  lcd.print(NoRot);
  lcd.print("  ");
  lcd.setCursor(11, 1);
  lcd.print(userspeed);
  lcd.print("  ");


  if (bps == LOW) {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Running");

    stepper.setMaxSpeed(speed);
    stepper.move(steps);
    while (stepper.distanceToGo() != 0) {
      stepper.run();
    }
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Speed (RPM): ");
    lcd.setCursor(0, 1);
    lcd.print("Speed (SPS): ");

  }

}
$abcdeabcde151015202530fghijfghij
A4988