Help with stepper motor and shield

I am trying to run a stepper motor at a specific speed without a time constraint. I want it to run indefinitely, but must run at the specific speed. I have created the code below, but there is a slight pause between loops. Can anyone help me come up with a way to run the stepper at the constant speed without a time limitation? I am using an Uno R3 and the official motor shield.

#include <Stepper.h>

// Map our pins to constants to make things easier to keep track of
const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 12;
const int dirB = 13;

// The amount of steps for a full revolution of your motor.
// 360 / stepAngle
const int STEPS = 170;

// Initialize the Stepper class
Stepper myStepper(STEPS, dirA, dirB);

void setup() {
  // Set the RPM of the motor

  // Turn on pulse width modulation
  pinMode(pwmA, OUTPUT);
  digitalWrite(pwmA, HIGH);
  pinMode(pwmB, OUTPUT);
  digitalWrite(pwmB, HIGH);

  // Turn off the brakes
  pinMode(brakeA, OUTPUT);
  digitalWrite(brakeA, LOW);
  pinMode(brakeB, OUTPUT);
  digitalWrite(brakeB, LOW);


void loop() {
  // Move the motor X amount of steps

It may be an issue with the library - see if AccelStepper library does better perhaps?

I can't seem to get AccelLibrary to work. I don't know how to set the wiring and braking for it. It doesn't seem to work with the arduino motor shield, but rather the off-shoots.

What about making your loop just do a single step (if I understand the code properly) like this ...


Then every step should be identical indefinitely.