comment arrêter une connexion Bluetooth?

bonjours a vous tous , :slight_smile:

donc pour avoir un connexion Bluetooth j'écris donc ce bout de code:

blueToothSerial.begin(38400);                             // Set BluetoothBee BaudRate to default baud rate 38400
blueToothSerial.print("\r\n+STWMOD=0\r\n");               // set the bluetooth work in slave mode
blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n");      // set the bluetooth name as "SeeedBTSlave"
blueToothSerial.print("\r\n+STOAUT=1\r\n");               // Permit Paired device to connect me
blueToothSerial.print("\r\n+STAUTO=0\r\n");               // Auto-connection should be forbidden here
delay(2000);                                              // This delay is required.
blueToothSerial.print("\r\n+INQ=1\r\n");                  // make the slave bluetooth inquirable
Serial.println("connexion au Link!");
delay(2000);                                              // This delay is required.
blueToothSerial.flush();

et pour arrêter la connexion Bluetooth que dois je écrire ?
je me suis alors aidé de cette doc http://www.seeedstudio.com/wiki/images/e/e8/BTSoftware_Instruction.pdf mais je n'ai pas réussie... =(

pouvez vous m aider ?

Merci d'avance :wink:

Salut dans ta doc il ya ceci :

  1. Disconnection
    Put PIO0 to high ,disconnect current device

je pense que si tu met ton Entre/sortie à l'état haut, ta connexion bleutooth va ce déco donc s’arrêter!

et bien j'ai essayer mais rien a faire =(

bonjour,
ca serait bien d'avoir le code entier :wink:
en général, c'est le maitre qui coupe la connexion, pas l'esclave.

bonjour,
alors voila mon code

#include <SoftwareSerial.h>   //Software Serial Port
#define RxD         10
#define TxD         11
#define DEBUG_ENABLED  1
SoftwareSerial blueToothSerial(RxD, TxD);



void setup() {
  Serial.begin(9600);

  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  setupBlueToothConnectionLink();
}

void loop() {
  {
    char recvChar;

    while (1)
    {
      if (blueToothSerial.available())
      { //check if there's any data sent from the remote bluetooth shield
        recvChar = blueToothSerial.read();
        Serial.print(recvChar);

        if (recvChar == '1')
        { Serial.print(recvChar);
        } else
        {
            // C'EST ICI QU'IL FAUT QUE JE COUPE MA CONNEXION 
          setupBlueToothConnectionSamsung();
        }
      }
    }

  }
}

void setupBlueToothConnectionLink()
{
 /* String retSymb = "+RTINQ=";                                   // start symble when there's any return
  String slaveName;                                // caution that ';'must be included, and make sure the slave name is right.
  int nameIndex = 0;
  int addrIndex = 0;

  String recvBuf;
  String slaveAddr  = ";00:21:3e:4a:d5:M13";*/
  
  
  blueToothSerial.begin(38400);                             // Set BluetoothBee BaudRate to default baud rate 38400
  blueToothSerial.print("\r\n+STWMOD=0\r\n");               // set the bluetooth work in slave mode
  blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n");      // set the bluetooth name as "SeeedBTSlave"
  blueToothSerial.print("\r\n+STOAUT=1\r\n");               // Permit Paired device to connect me
  blueToothSerial.print("\r\n+STAUTO=0\r\n");  // Auto-connection should be forbidden here
  delay(2000);                                              // This delay is required.
  blueToothSerial.print("\r\n+INQ=1\r\n");                  // make the slave bluetooth inquirable
  Serial.println("connexion au Link!");
  delay(2000);                                              // This delay is required.
  blueToothSerial.flush();
  
 /*  blueToothSerial.begin(38400);                                 // Set BluetoothBee BaudRate to default baud rate 38400
    blueToothSerial.print("\r\n+STWMOD=1\r\n");                   // set the bluetooth work in master mode
    blueToothSerial.print("\r\n+STNA=SeeedBTMaster\r\n");         // set the bluetooth name as "SeeedBTMaster"
    blueToothSerial.print("\r\n+STAUTO=1\r\n");                   // Auto-connection is forbidden here
    delay(2000);                                                  // This delay is required.
    blueToothSerial.flush();
    blueToothSerial.print("\r\n+INQ=1\r\n");                      //make the master inquire
    Serial.println("Master is inquiring!");
    delay(2000); // This delay is required.*/
}


void setupBlueToothConnectionSamsung()
{
  /*String retSymb = "+RTINQ=";                                   // start symble when there's any return
  String slaveName;                                // caution that ';'must be included, and make sure the slave name is right.
  int nameIndex = 0;
  int addrIndex = 0;

  String recvBuf;
  String slaveAddr = ";98:52:B1:20:BF:5b";*/

    blueToothSerial.begin(38400);                                 // Set BluetoothBee BaudRate to default baud rate 38400
    blueToothSerial.print("\r\n+STWMOD=1\r\n");                   // set the bluetooth work in master mode
    blueToothSerial.print("\r\n+STNA=SeeedBTMaster\r\n");         // set the bluetooth name as "SeeedBTMaster"
    blueToothSerial.print("\r\n+STAUTO=1\r\n");                   // Auto-connection is forbidden here
    delay(2000);                                                  // This delay is required.
    blueToothSerial.flush();
    blueToothSerial.print("\r\n+INQ=1\r\n");                      //make the master inquire
    Serial.println("Master is inquiring!");
    delay(2000); // This delay is required.


 /* blueToothSerial.begin(38400);                             // Set BluetoothBee BaudRate to default baud rate 38400
  blueToothSerial.print("\r\n+STWMOD=0\r\n");               // set the bluetooth work in slave mode
  blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n");      // set the bluetooth name as "SeeedBTSlave"
  blueToothSerial.print("\r\n+STOAUT=1\r\n");               // Permit Paired device to connect me
  blueToothSerial.print("\r\n+STAUTO=1\r\n");               // Auto-connection should be forbidden here
  delay(2000);                                              // This delay is required.
  blueToothSerial.print("\r\n+INQ=1\r\n");                  // make the slave bluetooth inquirable
  Serial.println("The slave bluetooth is inquirable!");
  delay(2000);                                              // This delay is required.
  blueToothSerial.flush();*/

}

voila est a la base je veux mettre fin a la connexion du link pour passé au samsung

quelqu'un aurait il une idée ?

Help :frowning: