HC-06 pairing and AT command problem

There’s a problem in pairing HC-06 module and PC.
I connected HC-06 with arduino UNO and compiled AT command code like below,
but my PC and smartphone couldn’t find HC-06.
And AT+NAME command do not work nevertheless ,in the last time, it worked.

#include <SoftwareSerial.h>
SoftwareSerial btSerial(2,3);
void setup()
{
  Serial.begin(9600);
  btSerial.begin(9600); 
}
void loop()
{
    if(Serial.available())
    {
      delay(5);  
      while(Serial.available())
      {
        btSerial.write(Serial.read());
      }
    }
    if(btSerial.available())
    {
      delay(5);  
      while(btSerial.available())
      {
        Serial.write(btSerial.read());
      }
    }
}

Please help!