     return 0;
 }
 
-

    return 0;
}

//Checks if the response "OK" is received
void CheckOK()
{
 char a,b;
 while(1)
 {
   if(blueToothSerial.available())
   {
     a = blueToothSerial.read();

     if('O' == a)
     {
       // Wait for next character K. available() is required in some cases, as K is not immediately available.
       while(blueToothSerial.available()) 
       {
         b = blueToothSerial.read();
         Serial.print(b);
         break;
       }
       if('K' == b)
       {
         break;
       }
     }
   }
 }

 while( (a = blueToothSerial.read()) != -1)
 {
   //Wait until all other response chars are received
 }
}

void sendBlueToothCommand3(char command[])
{
 blueToothSerial.print(command);
 Serial.print(command);
 CheckOK();   
}

//receive message from Bluetooth with time out
int recvMsg(unsigned int timeout)
{

#define RxD 2
#define TxD 3


SoftwareSerial blueToothSerial(RxD,TxD);//the software serial port 

