Shield Bluetooth Grove v2 - reception problem

Hello



I want to receive and send values to an Arduino board from a smartphone (Android) using bluetooth.



I use an Arduino Mega 2560 and a Grove Bluetooth shield v2.

My test code is at the end of the message.



From a terminal on the smartphone, I succeeded to receive values written in the serial monitor. But nothing is received in the serial monitor when I write from the smartphone terminal.



Have you some advice, please ?



Thanks in advance.

[code]
#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()
{
blueToothSerial.flush();
if (blueToothSerial.available()) {
Serial.write(blueToothSerial.read());
}
if (Serial.available()) {
blueToothSerial.write(Serial.read());
}
}

void setupBlueToothConnection()
{

blueToothSerial.begin(9600);                     // Set BluetoothBee BaudRate to default baud rate 9600
blueToothSerial.print("AT");
delay(500);
blueToothSerial.print("AT+DEFAULT");             // Restore all setup value to factory setup
delay(500);
blueToothSerial.print("AT+NAMEBLTTT");    // set the bluetooth name name must less than 12 characters.   
delay(500);
//blueToothSerial.print("AT+ROLEM");             // set the bluetooth work in master mode
delay(500);
blueToothSerial.print("AT+PIN0000");             // set the pair code to connect
delay(500);
blueToothSerial.print("AT+AUTH1");       
delay(500);                                     // This delay is required.
//blueToothSerial.flush();

}
[/code]

Hi there,



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, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).



So please change the pins to below, it will work.



#define RxD 10

#define TxD 9





For more info, please refer to https://www.arduino.cc/en/Reference/SoftwareSerial thanks.