Configuration Bluetooth (HC-06 module) from Android - PROBLEMS!

Hello

I'm developing a code to send and receive code from Android phone to Arduino using Bluetooth (HC-06 module).

Now I'm using Arduino Leonardo but then I need to use an Arduino Mini Pro (because the size).

And all is working right. I can send and receive data from Android to arduino and viceversa.

The problem is that I want to change the name and the password from Android and I test a lot of things but nothing work properly.

#include <SPI.h>

String BT_msg, type_msg;

void setup() {
  Serial1.begin(9600);  //BT
}

void loop() {                                         ////// RECEIVE A STRING FROM PHONE
  while (Serial1.available()) {
    delay(10); 
    char c = Serial1.read(); 
    BT_msg += c; 
  }
  if(BT_msg.length() > 0) {              ////////// IT DO TWO STRINGS WITH THE MAIN STRING
    type_msg = BT_msg.substring(0, 1);
    BT_msg = BT_msg.substring(2, BT_msg.length());
  }
  if (BT_msg != "") {
    BT_options();                    ///////////////// CALL FUNCTION BT_OPTIONS
  }
  type_msg="";                       //// CLEAN VARIABLES
  BT_msg="";
}

void BT_options() {
  char lett = type_msg.charAt(0); 
  switch (lett) {
     case '1':                                  ////// IF THE FIRST PART OF THE STRING IS 1 PRINT HELLO
       Serial.println("HELLO");
       break;
       
     case '2':                                  ///////////  IF THE FIRST PART OF THE STRING IS 2 TRY TO CHANGE THE NAME OF THE BT MODULE
       Serial.println("AT+NAME" + BT_msg);
       delay(1000);
       Serial1.println("2*" + BT_msg);    ///// AND SEND A MESSAGE TO ANDROID PHONE WITH THE NAME
       break;
       
     default:
       Serial.print("TEST");
       break;
  }
  delay(1500);
}

BUT DOESN'T WORK, THE NAME DOESN'T CHANGE :cry:

Someone knows something about change the name (or the password) of the HC-06 from ANDROID??

Why should it be from android ? And im not really sure you can do that.. :frowning: :frowning:

Insert Quote
well I think that if I can change the name from arduino writing in Serial > "AT+NAMEandthenwename"

It's very probable that I can do the same from my mobile, sending the message.

Maybe I need to reboot the Bluetooth module after (but I test it and doesn't work)

I want to control the name and the password of bluetooth module without computer just with my mobile. Is it strange?