 #define Y_MIN_PIN          14
 #define Y_MAX_PIN          15
 
-#define MIN_DELAY          100 // minimum timer tick
+#define MIN_DELAY          20 // minimum timer tick
 
 // these are initialized in reset()
 int stepsize;

}

void reset() {
    stepsize = 1;
    varDelayX = MIN_DELAY;
    varDelayY = MIN_DELAY;
    moveX = -1;
    moveY = -1; 
     
    timerX = 0; // timer accumulator for stepper X
    timerY = 0; // timer accumulator for stepper Y
    timerTick = MIN_DELAY; // microseconds per timer tick
    stateX = false;
    stateY = false;
}

void stepperInterrupt(void) {
    if (moveX >= 0) {
          timerX++;
          if (timerX * timerTick >= varDelayX) {
            timerX = 0;
            stateX = !stateX;
            digitalWrite(X_DIR_PIN, moveX == 0 ? LOW : HIGH);
            digitalWrite(X_STEP_PIN, stateX);
          }
    }

    if (moveY >= 0) {
          timerY++;
          if (timerY * timerTick >= varDelayY) {
            timerY = 0;
            stateY = !stateY;
            digitalWrite(Y_DIR_PIN, moveY == 0 ? LOW : HIGH);
            digitalWrite(Y_STEP_PIN, stateY);
          }
    }
}


                break;

            case 'u':
                if (moveY == 0) moveY = -1; else moveY = 1;
                break;
            case 'j':
                if (moveY == 1) moveY = -1; else moveY = 0;
                break;
            case 'k':
                if (moveX == 0) moveX = -1; else moveX = 1;
                break;
            case 'h':
                if (moveX == 1) moveX = -1; else moveX = 0;
                break;

            case 'm':
                readNumber();
                number = str.toInt();
                varDelayX = number;
                if (varDelayX < MIN_DELAY) varDelayX = MIN_DELAY; 
                Serial.print("speedX = ");
                Serial.println(varDelayX);
                break;
