Bluetooth Bee, Bees Shield, and LEDHead - Not initialising?

Hello all,

I’m trying to get a Bluetooth Bee working with the example as set out on the wiki page.

However, while the program appears to be doing its job, the red and green LEDs do not light up (the green LED double blinks per second), and I am unable to connect from my Macbook or Huawei U8300.

In fact, I’ve needed to comment out the “CheckOK” routine, as it was impeding program flow.

At the moment, I don’t possess a UartSBee, but thats next on my list if I can’t get an answer from anyone. In the meantime, I’ll paste my code for one and all to look at:

/* Upload this sketch into Seeeduino and press reset*/
 
#include <NewSoftSerial.h>   //Software Serial Port
#define RxD 8
#define TxD 7
 
#define DEBUG_ENABLED  1
 
NewSoftSerial blueToothSerial(RxD,TxD);
 
void setup() 
{ 
  Serial.begin(9600);
    pinMode(RxD, INPUT);
    pinMode(TxD, OUTPUT);
    setupBlueToothConnection();
 
} 
 
void loop() 
{ 
 
  if(blueToothSerial.read() == 'a')
 
  {
    blueToothSerial.println("You are connected to Bluetooth Bee");
    //You can write you BT communication logic here
  }
 
 
} 
 
void setupBlueToothConnection()
{
  Serial.print("Setting up Bluetooth link");
    blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
    delay(1000);
    sendBlueToothCommand("\r\n+STWMOD=0\r\n");
    sendBlueToothCommand("\r\n+STNA=modem\r\n");
    sendBlueToothCommand("\r\n+STAUTO=0\r\n");
    sendBlueToothCommand("\r\n+STOAUT=1\r\n");
    sendBlueToothCommand("\r\n+STPIN=0000\r\n");
    delay(2000); // This delay is required.
    blueToothSerial.print("\r\n");
    blueToothSerial.print("+INQ=1");
    blueToothSerial.print("\r\n");
    delay(2000); // This delay is required.
    Serial.print("Setup complete");
 
}
/* 
//Checks if the response "OK" is received.
void CheckOK()
{
  char a,b;
  while(1)
  {
    if(int len = blueToothSerial.available())
    {
    a = blueToothSerial.read();
 
    if('O' == a)
    {
      b = blueToothSerial.read();
      if('K' == b)
      {
        break;
      }
 
    }
   }
  }
 
  while( (a = blueToothSerial.read()) != -1)
  {
    //Wait until all response chars are received
  }
} 
 */
//Send the command to Bluetooth Bee
void sendBlueToothCommand(char command[])
{
    blueToothSerial.print(command);
    //CheckOK();   
}

Hopefully someone will have some insight.

Thanks!

Boris.

Hello Boris,

May I know how the Bluetooth Bee is connected to Arduino / Seeeduino ?

Are you using XBee shield ? If so please set both toggle switches to left side (Refer garden.seeedstudio.com/index.php … h_Position).

The idea is to connect BluetoothBee Rx and Tx to Arduino Digital pin 11 and 12 .

If you do not wish to use flow control mechanism, modify your program to use a delay of 3 seconds instead of CheckOK() :

void sendBlueToothCommand(char command[])
{
blueToothSerial.print(command);
delay(3000);
}

Bluetooth Bee takes some time to process commands. New commands have to be sent only after the old one is executed. Hence the delay is required.

I have added a delay based implementation with debugging feature to garden (Please use this sketch garden.seeedstudio.com/index.php … ementation )

Let me know if you still face any issue.

Regards,
Viswa