Just can't connect my Seeed Bluetooth shield

Hi guys,

I installed my Seeed Bluetooth shield on my Arduino Uno.

I can connect to it from my Android phone (so board in slave mode), and send/receive data, so i guess i’ve got the RX/TX pins right.

Now i want my Seeed BT shield to work in Master mode and connect to a Bluetooth Subpac 2 using the code below. But it just does not connect. I tried many variations to the code, removed the line with the pin code as well, nothing. I can easily connect to this Bluetooth Subpac 2 using my phone.

I’m just running out of ideas.

#include <SoftwareSerial.h>                     // Software Serial Port
 
 
#define RxD 2
#define TxD 3
 
 
#define DEBUG_ENABLED  1
 
 
// Make sure you modify this address to the one in your Slave Device!!
String slaveAddr = "00,02,5B,00,A5,A5"; // MAC ADDRESS OF SUBPAC 2
 
 
SoftwareSerial blueToothSerial(RxD,TxD);
 
 
void setup()
{
  Serial.begin(9600);
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  setupBlueToothConnection();
  //wait 1s and flush the serial and btooth buffers
  delay(1000);
  Serial.flush();
  blueToothSerial.flush();
}
 
 
void loop()
{
  char recvChar;
 
 
  // Infinite loop
  while(1)
  {
    // If there is data pending to be read from the shield
    if(blueToothSerial.available())
    {
      recvChar = blueToothSerial.read();
      // Print the data through the Serial channel
      Serial.print("Master Received: ");
      Serial.print(recvChar);
      Serial.print("\n");
    }
    // If there is data pending to be read from the serial port
    if(Serial.available())
    {
      recvChar  = Serial.read();
      // Send the data through btooth
      blueToothSerial.print(recvChar);
      Serial.print("Master Transmitted: ");
      Serial.print(recvChar);
      Serial.print("\n");
    }
  }
}
 
 
// Function to start the connection. Make sure slaveAddr is set to the right
// value.
void setupBlueToothConnection()
{
  // Set BluetoothBee BaudRate to default baud rate 38400
  blueToothSerial.begin(38400);
  // set the bluetooth work in master mode
  blueToothSerial.print("\r\n+STWMOD=1\r\n");
  // set the bluetooth name (irrelevant)
  blueToothSerial.print("\r\n+STNA=Master20\r\n");
  blueToothSerial.print("\r\n+STPIN=1234\r\n");//Set Master pincode"0000",itmust be same as Slave pincode
  // Auto-connection is forbidden here
  blueToothSerial.print("\r\n+STAUTO=0\r\n");
  // This delay is required.
  delay(2000);
  blueToothSerial.flush();
  // This delay is required.
  delay(2000);
 
 
  //form the full connection command
  Serial.print("Connecting to slave: ");
  Serial.println(slaveAddr);
  //send connection command
  blueToothSerial.print("\r\n+CONN=" + slaveAddr + "\r\n");
  Serial.println("\r\n+CONN=" + slaveAddr + "\r\n");
  delay(5000);
}