How Do I Use A Serial Command to Stop a Motor Routine

I’m using an adafruit motor shield (v1) to control two stepper motors, with a bluetooth remote control, for a wheeled robot project. I can make the motors go forward, back, etc.

But how do I stop them when they are moving?

I tried adding an If statement for detecting a bluetooth signal in the middle of the stepper loop (see code below), but that stops the stepper after just one step. Thanks for the help. If anyone has any other suggestions for alternative robot libraries for driving stepper motors other than just the stock adafruit motor library, please let me know.

[code]
#include <AFMotor.h>
AF_Stepper motor1(200, 1);
AF_Stepper motor2(200, 2);
char cmdCode = '0';
int cmdValue = 0;
#define serial Serial
void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  motor1.setSpeed(30);  // 30 rpm
  motor2.setSpeed(30);  // 30 rpm
}
void processEvents() {
}
void loop()
{
  processEvents();
  //Receives commands from android device:
  {
    int inByte = serial.read();
    serial.println((char)inByte);
    switch ((char)inByte)
    {
      case 'f':   //Moves Both Motors Forward
        for (int i = 0; i < 1000; i++)
        int inByte = serial.read();
        if (inByte == 's') switch ((char)inByte);case 
        {
          motor1.step(1, FORWARD, DOUBLE);
          motor2.step(1, FORWARD, DOUBLE);
        }
        break;

      case 's':
        motor1.release();
        motor2.release();
        break;
    }
  }
}

[/code]

search for accelstepper, or multistepper.
in the program i am missing lots of {} and i see case....
make 2 functions: one for the receive of commands and another to set what should happen with the car.
and i am missing the run command in the loop

Success. It just needed a few more { } to separate make the loops work correctly. Thanks for pointing me in the right direction. Here is the finished code if anyone is interested. I may try the accelstepper library again as the project progresses.

[code]
#include <AFMotor.h>
AF_Stepper motor1(200, 1);
AF_Stepper motor2(200, 2);
char cmdCode = '0';
int cmdValue = 0;
#define serial Serial
void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  motor1.setSpeed(30);  // 30 rpm
  motor2.setSpeed(30);  // 30 rpm
}
void processEvents() {
}
void loop()
{
  processEvents();
  //Receives commands from android device:
  {
    int inByte = serial.read();
    serial.println((char)inByte);
    switch ((char)inByte)
    {
      case 'f':
        for (int i = 0; i < 1000; i++)
        {int inByte = serial.read();
        if ((char)inByte=='s')
        {motor1.release();
        motor2.release();
        break;
        }
        else
        {
          motor1.step(1, FORWARD, DOUBLE);
          motor2.step(1, FORWARD, DOUBLE);
        }
        }
        break;
          }
  }
}

[/code]