Stepper misses steps on low speeds

I followed this wiring diagram


The power supply for motors is 12V, 3.2A
Datasheet: https://www.datasheet4u.com/datasheet-pdf/MotionKing/17HS4401/pdf.php?id=928661
Model: 17HS4401
I bought the wheels which can be mounted directly on the motor shaft.
Motors run on full-step mode
I am building a self-balancing robot which weights 1.2kg approx.
I am testing the motor program using a potentiometer and later I will hook it up with a PID program.

Revised code

#include <AccelStepper.h>

// Define a stepper and the pins it will use
AccelStepper stepper(AccelStepper::DRIVER, 5, 4);

// This defines the analog input pin for reading the control voltage
// Tested with a 10k linear pot between 5v and GND
#define ANALOG_IN A0
double lastTime = 0;
double thisTime = 0;
void setup()
{
  stepper.setMaxSpeed(200);

}

void loop()
{ thisTime = millis();
  if ((thisTime - lastTime) > 100) {
    lastTime = thisTime;
    int analog_in = analogRead(ANALOG_IN);
    stepper.setSpeed(analog_in);
  }
  stepper.runSpeed();
}