A few problems with a geared stepper motor, external signal, Grove LCD !

I'm using an Arduino Uno to control a stepper motor for material deposition in a robot-assisted 3D printing process.
It's a Geared Stepper motor ratio of 5.18:1 and I control it through an external signal (sending from robot controller) to turn the motor on/off.
But It does not work as I expect. Here are the problems:

1- Sometimes the signal is high but the motor is off and vise versa. I'm wondering if it might be because of the "CHANGE" state interrupt or because the input signal changes too fast, so the microcontroller cannot adjust? (Honestly, it's not that fast, 1-second delay between on/off, but I was suspicious)

2-Motor speed is controlled by a potentiometer. but the change of the speed changes suddenly when I spin the potentiometer in its 1/4 to the end and the motor spins fast suddenly; it's not smooth at the last quarter!

3-I was using a shield and a grove LCD. It dramatically lowers the max speed of the stepper motor! So I need to remove both LCD and shield! I mean, the same code works better without a shield! is that normal?

4-I have tried AccelStepper, but for some reason, AccelStepper doesn't work well for this situation.

I really appreciate it if anyone can help me with these problems.

Here is the code:

#define startSwitch 3        //push button to start or stop motor
#define reverseSwitch 2    //push button for reverse pin 

#define driverPUL 9       //PUL pin
#define driverDIR 8      //DIR pin

#define speedPin A3          //potentiometer



// Variables
int pd = 500 ;          // pulse delay period
boolean onoroff = digitalRead(startSwitch) ;    //On Off Motor
boolean setdir = LOW ;          //set Direction


void setup (){
  
  pinMode (driverPUL, OUTPUT);
  pinMode (driverDIR, OUTPUT);
  pinMode (startSwitch, INPUT);
  
  
  attachInterrupt(digitalPinToInterrupt(startSwitch), startMotor, CHANGE);     
  attachInterrupt(digitalPinToInterrupt(reverseSwitch), revMotor, FALLING);
}


void loop() {
    
  if (onoroff == LOW) {    //turn the motor OFF
    digitalWrite(driverPUL, LOW);
  }

  else if (onoroff == HIGH) {    //turn th e motor ON
    
    pd = analogRead(speedPin);
    digitalWrite(driverDIR,setdir);

    digitalWrite(driverPUL,HIGH);
    delayMicroseconds(pd);
    digitalWrite(driverPUL,LOW);
    delayMicroseconds(pd);
 
  }
}


//Interupt Handler
void revMotor () {
  setdir = !setdir;
}

void startMotor () {
  onoroff = !onoroff ;
}

Why are you using interrupts - what is triggering them? If you are using buttons pressed by a human there is no need for interrupts.

You have not set pinMode for the reverseSwitch.

Is it possible the switches are bouncing - it would be more normal to use pinMode(pin, INPUT_PULLUP); or do you have external pull-up or pull-down resistors?

The way your code is written any other code in loop() - such as for the LCD - is going to slow the step rate simply because loop() will take longer to repeat.

Have a look at how the stepper is programmed with non-blocking code (i.e. without using delayMicroseconds() ) in the second example in this Simple Stepper Code.

Have a look at Using millis() for timing. A beginners guide if you need more explanation. The same techniques also work with micros()

You have no Serial.print statements to show (for example) what values you are getting from the potentiometer.

...R
Stepper Motor Basics