[unresolved issues] Comunication bluetooth on Arduino Mega

Hello,

I work on a school projet in France, I have to send an information from a mobile phone with an application made with App inventor on my Arduino mega by a bluetooth grove module. I've try to do some test to learn how may work the bluetooth communication, I chose a tutorial on google but it don't work. Finally I found the probleme with on of my classmate, that's work on an Arduino uno (i've try and that's ok) but not on a Mega
I work with a Mega 2560, a "Grove - Mega Shield", a grove bluetooth V3.01 and a led. I just try to turn the led on from my phone

My programme is :

#include <SoftwareSerial.h>

SoftwareSerial HC06(0,1);
const char DOUT_LED = 2;
String messageRecu;

void setup() {
  Serial.begin(9600);
  HC06.begin(9600);  
  pinMode(DOUT_LED, OUTPUT);
  digitalWrite(DOUT_LED, LOW);
}
 
void loop()
{
    while(HC06.available())     //Tant que le bluetooth est connecté
    {
      delay(3);
      Serial.println("ok");
      char c = HC06.read();
      //char c = Serial.read();
      messageRecu += c;
    }
    if (messageRecu.length() >0)
    {
      Serial.println(messageRecu);
      if (messageRecu == "1")     
        {digitalWrite(DOUT_LED, HIGH);delay(2000);}
      if (messageRecu == "0")
        {digitalWrite(DOUT_LED, LOW);delay(3000);}
      messageRecu="";
    }
}

The shield got foor UART ports
I put my Programm on App Inventor at The end.

A picture of the shiel :

SoftwareSerial HC06(0,1);

I see two immediate problems right there.

As the Mega has 3 spare HardwareSerial ports there is no need to use the much inferior SoftwareSerial.

And pins 0 and 1 are the pins for HardwareSerial Serial so they should not be used for SoftwareSerial even if it was appropriate to use SoftwareSerial.

Connect your HC06 to pins 19 and 18 and use Serial1

Also, it is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. This can happen after the program has been running perfectly for some time. Just use cstrings - char arrays terminated with '\0' (NULL).

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

...R