Pages: [1]   Go Down
Author Topic: [Problem of connexion] - Bluetooth Shield SLD63030P  (Read 724 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody, i'm here today to ask you about a problem than I meet with my BT shield. I've got an AT MEGA 2560. When I upload the code, I've only got the green light blinking 2 times per cycle instead the green and the red. I know that means the connection doesn't work but being a perfect newbie on arduino, I don't know if it's the code or the circuit. I receive "The slave bluetooth is inquirable!" from the Serial monitor displays as well. Looking for a request, I still have not found one. I've already seen :http://forum.arduino.cc/index.php?topic=120113.0 but vainly..

The code than I use is here :

Code:
#include <SoftwareSerial.h>   //Software Serial Port
//This is for the Arduino/seeeduino Mega.
//Not all pins on the Mega and Mega 2560 support change interrupts,
//so only the following can be used for RX: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
#define RxD 10
#define TxD 7
 
#define DEBUG_ENABLED  1
 
SoftwareSerial blueToothSerial(RxD,TxD);
 
void setup()
{
  Serial.begin(9600);
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  setupBlueToothConnection();
 
}
 
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(Serial.available()){//check if there's any data sent from the local serial terminal, you can add the other applications here
      recvChar  = Serial.read();
      blueToothSerial.print(recvChar);
    }
  }
}
 
void setupBlueToothConnection()
{
  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("The slave bluetooth is inquirable!");
  delay(2000); // This delay is required.
  blueToothSerial.flush();
}





Thanks !

(Sorry for my English, I'm not an English native)
« Last Edit: February 24, 2014, 03:45:12 pm by Coding Badly » Logged

Pages: [1]   Go Up
Jump to: