user61989: I have a problem , when send 1 or 0 by Bluetooth module the serial monitor print two time (RECEIVED SMS) . what's the wrong ?
This is my code  :
   char BluetoothData = 0 ; 
void setup() {
  // initialize serial communication:
  Serial.begin(9600);
    for (int pin = 1; pin <= 13; pin++)
     {
       pinMode(pin, OUTPUT); // sets the digitals pin  as outputs
       digitalWrite(pin, LOW); // sets the digitals pin off defult intial states 
     }  
       Serial.println("ALL LEDs NOW OFF \n "); 
       Serial.println("Please, Enter : ( 1 to Turn on All LEDs )  or ( 0 to Turn off LEDs ) \n");
}
void loop() {            
  // read the sensor:
  if (Serial.available() > 0) {

        BluetoothData = Serial.read();
            Serial.print("*** RECEIVED SMS *** : ==>> ");
            Serial.println(BluetoothData);

        if (BluetoothData == '1'){ 
        for (int Pin = 1; Pin <= 13; Pin++) {
          digitalWrite(Pin, HIGH);
          }  
          Serial.println("ALL LEDs NOW ON");
         }
        // turn all the LEDs off:
   else if (BluetoothData == '0') {
        for (int Pin = 1; Pin <= 13; Pin++) {
          digitalWrite(Pin, LOW);
          }
          Serial.println("ALL LEDs NOW OFF"); 
         }
  }
   delay(100);  
} 

This is photo for serial monitor 


user43663: In the Arduino IDE you should select "No Line Ending" from the menu, instead of "New line". Otherwise you are sending an extra "\n".

user31105: Probably the first time because you received the character '1' or '0'.
The second character is probably a '\0' or '\d', an end-of-string or end-of-line character.
You can easily check this by printing the value of each received character, like 
Serial.println((int)(BluetoothData));

You probably see the value for '0' (48), '1' (49), end of string '0' of end of line '13' or maybe '10' (new line).

61989: <p>I have a problem , when send 1 or 0 by Bluetooth module the serial monitor print two time <strong>(RECEIVED SMS)</strong> . what's the wrong ?</p>

<p><strong>This is my code  :</strong></p>

<pre><code>   char BluetoothData = 0 ; 
void setup() {
  // initialize serial communication:
  Serial.begin(9600);
    for (int pin = 1; pin &lt;= 13; pin++)
     {
       pinMode(pin, OUTPUT); // sets the digitals pin  as outputs
       digitalWrite(pin, LOW); // sets the digitals pin off defult intial states 
     }  
       Serial.println("ALL LEDs NOW OFF \n "); 
       Serial.println("Please, Enter : ( 1 to Turn on All LEDs )  or ( 0 to Turn off LEDs ) \n");
}
void loop() {            
  // read the sensor:
  if (Serial.available() &gt; 0) {

        BluetoothData = Serial.read();
            Serial.print("*** RECEIVED SMS *** : ==&gt;&gt; ");
            Serial.println(BluetoothData);

        if (BluetoothData == '1'){ 
        for (int Pin = 1; Pin &lt;= 13; Pin++) {
          digitalWrite(Pin, HIGH);
          }  
          Serial.println("ALL LEDs NOW ON");
         }
        // turn all the LEDs off:
   else if (BluetoothData == '0') {
        for (int Pin = 1; Pin &lt;= 13; Pin++) {
          digitalWrite(Pin, LOW);
          }
          Serial.println("ALL LEDs NOW OFF"); 
         }
  }
   delay(100);  
} 
</code></pre>

<p><strong>This is photo for serial monitor</strong> </p>

<p><a href="https://i.stack.imgur.com/2oP3m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2oP3m.png" alt="enter image description here"></a></p>
 43663: <p>In the Arduino IDE you should select &quot;No Line Ending&quot; from the menu, instead of &quot;New line&quot;. Otherwise you are sending an extra &quot;\n&quot;.</p>
 31105: <p>Probably the first time because you received the character '1' or '0'.
The second character is probably a '\0' or '\d', an <code>end-of-string</code> or <code>end-of-line</code> character.</p>

<p>You can easily check this by printing the value of each received character, like </p>

<pre><code>Serial.println((int)(BluetoothData));
</code></pre>

<p>You probably see the value for '0' (48), '1' (49), end of string '0' of end of line '13' or maybe '10' (new line).</p>
