Different max speeds on different sketch

Hello folks. I’m using the Dual VNH5019 Motor Shield mapped into single channel. I’m getting different max speeds on my little test motor from two different sketches of the same value.

This sketch has very high speed.

#include "DualVNH5019MotorShield.h"
// configure library with pins as remapped for single-channel operation
// this lets the single motor be controlled as if it were "motor 1"
DualVNH5019MotorShield md(2, 7, 6, A0, 2, 7, 12, A1);
void setup()
{
md.init();
// remaining setup code goes here

}
void loop()
{
// loops endlessly; main loop goes here
// the following code is a simple example:
md.setM1Speed(400); // single-channel motor full-speed "forward"
delay(2000); // wait for 2 seconds
md.setM1Speed(0); // single-channel motor stop (coast)
delay(500); // wait for 0.5 s
md.setM1Speed(-400); // single-channel motor full-speed "reverse"
delay(2000); // wait for 2 seconds
md.setM1Speed(0); // single-channel motor stop (coast)
delay(500);
}

This sketch has about 3/4 the speed of the previous sketch.

/*
Pololu VNH5019 resources:
https://www.pololu.com/docs/0J49 
*/

#include "DualVNH5019MotorShield.h"

DualVNH5019MotorShield md(2, 7, 6, A0, 2, 7, 12, A1);
int keyUp =5;                                            //Input from key to raise mast.
int keyDown =3;                                            //Input from key to lower mast.

void setup()
{
  pinMode(keyUp, INPUT_PULLUP);
  pinMode(keyDown, INPUT_PULLUP);
  md.init();                                               
}

void loop()
{
  if(digitalRead(keyUp) == LOW){                          //This reads the state of key switch and controls movement forward.
    md.setM1Speed(400);
    }
  else if(digitalRead(keyDown) == LOW){                   //This reads the state of key switch and controls movement reverse.  
    md.setM1Speed(-400);                                
    }
  else(digitalRead(keyUp) == HIGH && digitalRead(keyDown) ==HIGH);{  //This reads the state of key switch and keeps motor in brake.
    md.setM1Speed(0);                                              
    } 
}

replacing md.setM1Speed(0) with md.setM1Brake(400); seems to have solved my issues.

Hello.

I am glad you figured it out. Thanks for letting us know what you did.

-Jon