How to Apply brake on a motor driver with H bridge like Motorshield?

Well, I have burned my motorshield, and as I cannot get a new one as soon as I need it (by monday) I need to know how do I apply the brake to the DC motor with a H Bridge. Is it the same? Or how do I do that?

I also have this driver if its easier, that would be great.

This is my test code Im using, Im building a sumo bot but the inertia of the motors when they stop will make my robot to fell off the dojo. Thats why I need the brake function.

const int 
PWM_A   = 3,
DIR_A   = 12,
BRAKE_A = 9,
SNS_A   = A0;


void setup() {
  // Configure the A output
  pinMode(BRAKE_A, OUTPUT);  // Brake pin on channel A
  pinMode(DIR_A, OUTPUT);    // Direction pin on channel A

  // Open Serial communication
  Serial.begin(9600);
  Serial.println("Motor shield DC motor Test:\n");
}

void loop() {

// Set the outputs to run the motor forward

  digitalWrite(BRAKE_A, LOW);  // setting brake LOW disable motor brake
  digitalWrite(DIR_A, HIGH);   // setting direction to HIGH the motor will spin forward

  analogWrite(PWM_A, 255);     // Set the speed of the motor, 255 is the maximum value

  delay(5000);                 // hold the motor at full speed for 5 seconds
  Serial.print("current consumption at full speed: ");
  Serial.println(analogRead(SNS_A));

// Brake the motor

  Serial.println("Start braking\n");
  // raising the brake pin the motor will stop faster than the stop by inertia
  digitalWrite(BRAKE_A, HIGH);  // raise the brake
  delay(5000);

// Set the outputs to run the motor backward

  Serial.println("Backward");
  digitalWrite(BRAKE_A, LOW);  // setting againg the brake LOW to disable motor brake
  digitalWrite(DIR_A, LOW);    // now change the direction to backward setting LOW the DIR_A pin

  analogWrite(PWM_A, 255);     // Set the speed of the motor

  delay(5000);
  Serial.print("current consumption backward: ");
  Serial.println(analogRead(SNS_A));

  // now stop the motor by inertia, the motor will stop slower than with the brake function
  analogWrite(PWM_A, 0);       // turn off power to the motor

  Serial.print("current brake: ");
  Serial.println(analogRead(A0));
  Serial.println("End of the motor shield test with DC motors. Thank you!");


  while(1);
}

Setting both in1 and in2 (or in3 and in4) LOW with enable maintained HIGH should brake the motor. How much current for how long does braking cause? Can the L298 take it? See page 6/13, fig. 6 of datasheet: http://www.st.com/resource/en/datasheet/l298.pdf EDIT: You can parallel both L298 channels to one motor for twice the current (about 2 Amps/channel).

I already burned 2 of those drivers.

I made an H bridge with relays now. But Im still using the driver with another 2 motors. So, if I set both IN's from the driver will cause like a short circuit and brake the motor without inertia right? Thats cool. Imma try it. THanks bud.