SOLVED: One way Bluetooth Communication with Grove Bluetooth

Hello,
I use Grove Serial Bluetooth module + Arduino Mega 1280.
I try to communicate my Android phone (Samsung GS2) with my arduino.
On my Android phone I use the following application “S2 Bluetooth Terminal3” or “BlueTerm”
On the Arduino, I loaded the Bluetooth demo code (slave).

The bluetooth connection is done and I got the message “The slave bluetooth is inquirable!” on my phone when the Arduino start. So the communication Arduino->Phone is correct.

The problem is that I don’t receive anything on the Arduino board when I send data from the phone !

(I tried to sent data from my phone to a BT computer, with the same applications, and it works).

Any idea ?

The demo code I use :

#include <SoftwareSerial.h>   //Software Serial Port
#define RxD 6
#define TxD 7
 
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+STPIN=0000\r\n");//Set SLAVE pincode"0000"
  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();
}

The problem was the PIN used for SoftwareSerial !

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

The solution is to replace pin 6 & 7 by pin 10 & 11 for example.

hi,you are right.We always use Seeeduino/Arduino with Bluetooth,so pin is not a important problem~~~

And any help if I’m also using the new Grove Shield?
It doesn’t have the D10 available, only
D2, D3, D4, D5, D6, D7, D8
A0, A1, A2, A3
UART
I2C, I2C, I2C, I2C

Which one should I use?

I’m getting a strange behavior, I can see the arduino Bluetooth from a Win8.1 device, I pair the device, but it get connected for 60 seconds and it disconnects, after 30 secs it connects again, … and it repeat this behavior.

I’m testing with D8 and the following code

[code]void setupBlueToothConnection()
{
blueToothSerial.begin(9600); //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=ArduinoBtIoT\r\n"); //set the bluetooth name as “SeeedBTSlave”
blueToothSerial.print("\r\n+DLPIN\r\n");//delete pincode
blueToothSerial.print("\r\n+STPIN=1234\r\n");//Set SLAVE pincode"0000"
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();

}[/code]
Any ideas?

Thanks

Thanks for the info, but how then can your receive a list of all the SMSes on the SIM? Even 128/256 buffer size is not enough? Is there another way to this? Will it help if you use the arduino’s serials?