Arduino BT problem : Serial connection crash

Basically i'm driving two stepper motors and a pneumatic valve. The purpose is to make a sentry gun that fires ping pong balls with air pressure. Two motors turns the turret accordingly to the target which is detected with a cam mounted on the gun. The cam feed is processed in VVVV and the coordinates are send to arduino as (L)eft (X)right (U)p (D)own from serial connection over bluetooth. To stop turning, I'm sending (C)enter or (M)iddle. To shot (S).

So far so good but after a short while (between 1 and 45 seconds) the connection brakes (or freezes I really couldn't understand). Motors continiues to doing the last sent command. Not only VVVV, also I tried to send commands via serial monitor in arduino 10 but it freezes too after a while.

The code in arduino is below.

int incoming = 0;

int stepPin1 = 4;
int dirPin1 = 5;
int stepPin2 = 6;
int dirPin2 = 7;
int valvePin = 13;

int stepDelay = 1150;
int fireDelay = 500;
int fireAfterDelay = 5000;

int doPitch = 0;
int doYaw = 0;

void setup() {
      Serial.begin(115200);
        Serial.println("Ready!");
        
        pinMode(stepPin1, OUTPUT);
        pinMode(dirPin1, OUTPUT);
        pinMode(stepPin2, OUTPUT);
        pinMode(dirPin2, OUTPUT);
        pinMode(valvePin, OUTPUT);
}

void loop() {

      if (Serial.available() > 0) {
            incoming = Serial.read();
            Serial.println(incoming);

                //(U)P
                if(incoming == 85) {
                  digitalWrite(dirPin2, HIGH);
                  doPitch = 1;
                }
                
                //(D)OWN
                if(incoming == 68) {
                  digitalWrite(dirPin2, LOW);
                  doPitch = 1;
                }
                
                //(M)IDDLE
                if(incoming == 77) {
                  doPitch = 0;
                }
                
                //(L)EFT
                if(incoming == 76) {
                  digitalWrite(dirPin1, LOW);
                  delay(100);
                  doYaw = 1;
                }
                
                //(X)RIGHT
                if(incoming == 88) {
                  digitalWrite(dirPin1, HIGH);
                  delay(100);
                  doYaw = 1;
                }

                //(C)ENTER
                if(incoming == 67) {
                  doYaw = 0;
                }

                //(S)HOT !
                if(incoming == 83) {
                  Serial.println("FIRE!");
                  digitalWrite(valvePin, HIGH);
                  delay(fireDelay);
                  digitalWrite(valvePin, LOW);
                  Serial.println("RELOAD!");
                  delay(fireAfterDelay);
                }
      }
        // STEPPER CODE
        if ( doPitch == 1 ) {
          digitalWrite(stepPin2, HIGH);
          delayMicroseconds(2);
          digitalWrite(stepPin2, LOW);
          delayMicroseconds(stepDelay);
        }
        if ( doYaw == 1 ) {
          digitalWrite(stepPin1, HIGH);
          delayMicroseconds(2);
          digitalWrite(stepPin1, LOW);
          delayMicroseconds(stepDelay);
        }
}

and this is the VVVV snapshot

If anything seems wrong please comment.

Thanks.

it would be worth trying at a lower baud rate to see if your porblem is speed related. My (non BT) serial connection is not always happy at 115k baud.

as i know you have to use the arduino BT at 115 baud or it doesnt work at all.

"Only communicate at 115200 baud using the serial commands (e.g. Serial.begin(), etc.). This is the speed for which the bluetooth is configured."