Bluetooth led won't light on

Hi
I have my bluetooth working (can send messages and they appear in the Arduino monitor..)
baud rate is 115200

But the Led won't light on when sending value"1" ... ?
led is correctly plugged in.
Any Ideas
Thanks a lot
Philippe

#include <SoftwareSerial.h>
SoftwareSerial HMSoft(6,7);
const char LED = 9 ;
String messageRecu;

void setup() {
  Serial.begin(115200);
  HMSoft.begin(115200);  
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);
}
 
void loop()
{
    while(HMSoft.available())
    {
      delay(10);
      char c = HMSoft.read();
      messageRecu += c;
    }
    if (messageRecu.length() >0)
    {
      Serial.println(messageRecu);
      if (messageRecu == "1")     
        {digitalWrite(LED, HIGH);}
      if (messageRecu == "0")
        {digitalWrite(LED, LOW);}
      messageRecu="";
    }
}

Does the sender append a line feed (/n) and/or a carriage return to the sent message?

are you sure that the length of 'messageRecu' is exact and ONLY one character long? When transmitting, a 0 byte or a CR can also be added. When receiving, you simply convey everything that comes in in your 'while' loop into the char variable 'messageRecu'. but there are usually also 'end of transmission' characters. And so the comparison 'messageRecu == "1"' does not work because 'messageRecu' always consists of several characters. So you have to make sure when receiving that ONLY the actual command ends up in messageRecu.

Since you are using the String class the trim() function may be of interest. The trim() function can remove any white space characters (\n \r) from the serial input.