Go Down

Topic: Bluetooth Shield Seeeduino (Read 853 times) previous topic - next topic

Ryan_MX

Hi y'all,
Good morning for ones who have some sun and evening for the others. :)

I've encountered a problem with my two Bluetooth Shields that I've purchased on the Seeedstudio website.

I've followed the instructions on the wikipage to make them communicate but it doesn't work and I cannot sleep since one week  :(
Plz HELP

Despite of all my efforts, the green LED blinks always twice a second.I've also bought a packet sniffer from TI to check if there is any transmission of the bluetooth signal but is not  :cry:

What solutions can you provide PLZ
anything is welcomed!

Thanks and have a good day

that's is the code I also tried to connect with the CC2541 sensortag from TI:

Code: [Select]
/*
In this code, we are goin' to test
the communication between one Arduino Uno Card and the sensor tag
through a bluetooth connection

This code is uploaded in the Master Board

*/
#include <SoftwareSerial.h>

//Pins 2 and 3 defined as RX and TX
#define Rx 2
#define Tx 3


//On crée un objet blueToothSerial pour utiliser l'Uart sur les broches RX et TX
SoftwareSerial blueToothSerial(Rx,Tx); // RX, TX

//Variable which contains received data from the Bluetooth link
char received = '0';

//Buffer which contains data received from the terminal
String received_terminal = "";

//Buffer which contains data received from the Bluetooth link
String received_bt = "";

//Declaration of the buffer of reception
String received_buffer="";
   
//Boolean variable which turn into true if
//Something has been read
boolean reception_OK=false;
   

/************************************************************************************************************
*Setup Function                                                                                             *
************************************************************************************************************/
void setup() 
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  pinMode(Rx,INPUT);
  pinMode(Tx,OUTPUT);

  //Function which initialize Bluetooth connection
  setupBlueToothConnection();

}


/*************************************************************************************************************
**Infinite loop                                                                                             *
*************************************************************************************************************/
void loop()
{
   
    //On vérifie si on a reçu des données via la liaison Bluetooth
    if(blueToothSerial.available()>0)
    {
        //recu_bt is a variable which contains
        //what is read by the bluetooth link
        char recu_bt = blueToothSerial.read();
       
        received_bt += recu_bt;
       
        //We confirm reception
        Serial.println("Bluetooth received");
       
        //We display what we just received
        Serial.println(received_bt);
       
    }
       
       
    if(Serial.available())
    {
        //recu is a variable which contains
        //what is read by the serial link
        char recu = Serial.read();
       
        received_terminal += recu;
       
        if(recu=='\n')
        {
          Serial.println("All received");
         
          Serial.print("La commande est:\r");
         
          Serial.println(received_terminal);
         
          Serial.println("Sending by Bluetooth");         
         
          String received_terminal_n = received_terminal;
         
          received_terminal_n.replace("\n","\r");
                           
          String Commande_blueTooth = "\r\n";
         
          Commande_blueTooth += received_terminal_n;
         
          Commande_blueTooth += "\n";
         
          blueToothSerial.print(Commande_blueTooth);
         
          received_terminal="";       
        }
         
     }         
}


/************************************************************************************************************
*Function which initialize Bluetooth Connection                                                             *
************************************************************************************************************/
void setupBlueToothConnection()
{
     //Set BluetoothBee BaudRate to default baud rate 38400
    blueToothSerial.begin(38400);
   
    //Configuring the Board as Master
    blueToothSerial.print("\r\n+STWMOD=1\r\n");
   
    //The name of our master is just MASTER
    blueToothSerial.print("\r\n+STNA=MASTER\r\n");
   
    //Activating the auto-connection mode
    blueToothSerial.print("\r\n+STAUTO=1\r\n");
   
    //Permit to paired devices to connect at UNO
   // blueToothSerial.print("\r\n+STOAUT=1\r\n");
   
    delay(2000); // This delay is required.
   
    //make the master inquire
    blueToothSerial.print("\r\n+INQ=1\r\n");
   
    Serial.println("Master is inquiring!");
     
    delay(2000); // This delay is required.
   
    blueToothSerial.flush();
   
   
    //Get back datas from the slave
    while(blueToothSerial.available()>0)
    {
        received = blueToothSerial.read();
        received_buffer += received;
        reception_OK=true;
    }
   
    //We check if something has been read
    if(reception_OK)
    {
      //We display what we have received
      Serial.println(received_buffer);
      Serial.println("Connexion etablie");
    }
    else
    {
      Serial.println("NOTHING has been read!!");
    }
   
   
   
   
   
    //Connecting to the sensor Tag
    //whose MAC Adress is:0x9059AF0AAB43
    blueToothSerial.print("\r\n+CONN=90,59,AF,0A,AB,43\r\n");
   
    blueToothSerial.flush();
    while(blueToothSerial.available()>0)
    {
        received = blueToothSerial.read();
        received_buffer += received;
        reception_OK=true;
    }
   
    //We check if something has been read
    if(reception_OK)
    {
      //We display what we have received
      Serial.println(received_buffer);
      Serial.println("Connexion au SensorTag etablie");
    }
    else
    {
      Serial.println("NOTHING has been read!!");
    }
   
   
   
   
   /*
    blueToothSerial.flush();
   
    //Connecting to the round red thing
    //whose MAC Adress is:0xD466D8E68E5D
    blueToothSerial.print("\r\n+CONN=D4,66,D8,E6,8E,5D\r\n");
   
    if(blueToothSerial.available()>0)
    {
          Serial.println("Connexion au bidule rouge etablie");
    }
    */
   
}


Go Up