Control my Robot with HC-06 BT, but connection drops

hi
i ve made a simple robot with 3 legs
and i am trying to control it with this HC-06 BT device that used to work well when i used it to switch some Relay…

well i am communicating with arduino with an android and the software RoboRemo
(but i tried another software, same results),

when i send the first command thru the android (a “0”)
the robot moves
and then the connection drops.

same problem if i connect it to a battery (instead of the mac-usb)

i paste the code here
dont know whatelse i can do

#include <Servo.h>

Servo leg1;
Servo leg2;
Servo leg3;

char data;

const int X_pin = 0; // analog 0 per X Joystickt
const int Y_pin = 1; // analog 1 per Y Joystick
const int SW_pin = 2; // digital pin connected to switch output

int leg1Pin = 9;
int leg2Pin = 10;
int leg3Pin = 11;

int xpos = 115;
int ypos = 115;

int leg1Pos;
int leg2Pos;
int leg3Pos;



/**** IMPORTANTI ****/
int legreset = 100;

int su = -22;
int giu = 22;
int suMezzo = -11;
int giuMezzo = 11;
/*********************/

int statoSu;
int statoGiu;
int statoGiuMezzo;
int statoSuMezzo;

void setup() {

  pinMode(SW_pin, INPUT);
  pinMode(leg1Pin, OUTPUT);
  pinMode(leg2Pin, OUTPUT);
  pinMode(leg3Pin, OUTPUT);
  
  digitalWrite(SW_pin, HIGH);
  Serial.begin(9600);
  
  leg1.attach(leg1Pin);
  leg2.attach(leg2Pin);
  leg3.attach(leg3Pin);

  leg1Pos = legreset;
  leg2Pos = legreset;
  leg3Pos = legreset;

  leg1.write(legreset);
  leg2.write(legreset);
  leg3.write(legreset);

  Serial.println(" ROBOT READY ");

}

void loop() {

  xpos = map(analogRead(X_pin), 0, 1024, -10, 10);
  ypos = -map(analogRead(Y_pin), 0, 1024, -10, 10);
  
  /* Serial.print("X-axis: ");
  Serial.print(xpos);
  Serial.print("\n");
  Serial.print("Y-axis: ");
  Serial.println(ypos);
  Serial.print("\n\n");
  */
  statoSu = legreset + su;
  statoGiu = legreset + giu;
  statoSuMezzo = legreset + suMezzo;
  statoGiuMezzo = legreset + giuMezzo;
  
  
  
   if(Serial.available() > 0) {
    data = Serial.read();      //Read the incoming data and store it into variable data
    Serial.print(data);        //Print Value inside data in Serial monitor
    Serial.print("\n");        //New line 
   
  if (data == '0')  {
    leg1Pos = statoSu;
    leg2Pos = statoGiu;
    leg3Pos = statoGiu;
    passo();    
    delay(200);
    riposiziona();
    delay(100);
  }

   
 if (data == '1')  {
  riposiziona ();
 }
      

 }   

}


void passo () {
    leg1.write(leg1Pos);
    leg2.write(leg2Pos);
    leg3.write(leg3Pos);
}


void riposiziona () {

    leg1Pos = legreset;
    leg2Pos = legreset;
    leg3Pos = legreset;
    leg1.write(leg1Pos);
    leg2.write(leg2Pos);
    leg3.write(leg3Pos);

}

when i send the first command thru the android (a “0”)
the robot moves
and then the connection drops.

Does the RX LED continue to blink?

A complete schematic is in order.

PaulS: Does the RX LED continue to blink?

yes, after the connection drops, the module start blinking

might be because 3 servo motors are too much to handle?

If you mean the STATE LED on the bluetooth module was steady and then starts blinking, then yes you have lost the connection and, yes, it may well be a power problem resulting from the servos causing a dip in supply, and bluetooth is innocent.

Nick_Pyner: If you mean the STATE LED on the bluetooth module was steady and then starts blinking, then yes you have lost the connection and, yes, it may well be a power problem resulting from the servos causing a dip in supply, and bluetooth is innocent.

thanks mate i connected the servo to an external battery

and that was the problem :)