Bluetooth bee +bees shield , it works?

wireless communication and related Bees.

Moderators: lily.li, violet, jessie

Post Reply
dr4gone
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Tue May 28, 2013 1:26 am

Bluetooth bee +bees shield , it works?

Post by dr4gone » Tue May 28, 2013 1:52 am

Hi everybody, I'm trying to make work a bluetooth bee module on a bees shield with arduino UNO R3.
http://www.seeedstudio.com/depot/blueto ... p-598.html
http://www.seeedstudio.com/depot/bees-shield-p-672.html
It's seem not work to me.

I want to make a simple discovery of all nearby MAC address.

I put the jumper BEE_1 RX on PIN 5 and BEE_1 TX pin PIN 6

And the code that i use , is this:

Code: Select all

#include <SoftwareSerial.h>   //Software Serial Port

#define RxD 5
#define TxD 6
 
#define DEBUG_ENABLED  1

char recvChar;
String recvBuf;
String recvAddr;
String recvInq;

SoftwareSerial blueToothSerial(RxD,TxD);
 
void setup() 
{ 
  Serial.begin(9600);
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  setupBlueToothConnection();
  //wait 1 sec and flush the serial buffer
  delay(1000);
  Serial.flush();
  blueToothSerial.flush();
  Serial.println(" ");
  Serial.println("restarted....");
  Serial.println("Starting BTScan....");

} 

void loop()
{
  btScan();
}

void setupBlueToothConnection()
{
  blueToothSerial.begin(38400); //Set Bluetooth to 38400
  blueToothSerial.print("\r\n+STWMOD=1\r\n");//set bluetooth to master mode
  blueToothSerial.print("\r\n+STNA=MyBTname\r\n");//set bluetooth name 
  blueToothSerial.print("\r\n+STAUTO=0\r\n");// no Auto-connection
  delay(2000); // This delay is required.
  blueToothSerial.flush();
  blueToothSerial.print("\r\n+INQ=1\r\n");//make the master inquire
  delay(2000); // This delay is required.
}
    
void btScan()  //scan for devices
{
  if (blueToothSerial.available())
  {
    recvChar = blueToothSerial.read();
    recvBuf += recvChar;
    if (((recvChar > 47) && (recvChar < 58)) || ((recvChar > 64) && (recvChar < 71)))  // get numbers and A-F only
    {
      recvAddr += recvChar;
      if(recvAddr.length()==12)
      {
        Serial.println(recvAddr);
        recvAddr = "";
        blueToothSerial.flush();
      }
    }
  }
}
It's seems correct, but the blueToothSerial does not seem turn available.

My question is:
If the code is correct, it is possible that the two components are not compatible?
What could be wrong?

Thanks in advance

User avatar
Jacket Chen
Staff
Staff
Posts: 659
Joined: Thu Jun 21, 2012 4:25 pm
Are you a staff member of seeedstudio?: yes
Which products/projects are your favorite?: Seeeduino Shields
Location: China

Re: Bluetooth bee +bees shield , it works?

Post by Jacket Chen » Thu May 30, 2013 9:53 am

hey , you need put the jumper BEE_1 RX on PIN 6 and BEE_1 TX pin on PIN 5.
Love little, love long.

dr4gone
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Tue May 28, 2013 1:26 am

Re: Bluetooth bee +bees shield , it works?

Post by dr4gone » Sat Jun 01, 2013 3:04 pm

Thank's IT WORKS! :mrgreen:

Post Reply