Help with RN-42 Bluetooth module

I am using two RN 42 Bluetooth modules and two arduino boards(1 Mega and 1 Due)....I want to create a connection between the two and after reading the manual for RN devices I wrote the following codes for slave and master but they are not working....The two bluetooth devices are not getting connected also....Plzzz help with what could be the problem with code

For Mastervoid setup()
{
Serial.begin(9600);
Serial.print("$$$");
delay(100);
Serial.println("SM,1");
delay(1000);
while(!Serial.println("C,000666495767"));
delay(1000);
Serial.println("---");
pinMode(13,OUTPUT);

}

void loop() {
if(Serial.print("H"))
digitalWrite(13,HIGH);
delay(5000);
if(Serial.print("L"))
digitalWrite(13,LOW);
delay(5000);

// put your main code here, to run repeatedly:

}

For Slave
void setup()
{
Serial.begin(9600);
Serial.print("$$$");
delay(1000);
Serial.println("SM,0");
delay(1000);
Serial.println("---");
pinMode(13,OUTPUT);

}

void loop() {
while(Serial.available()==0);
char ch=Serial.read();
if(ch=="H")
digitalWrite(13,HIGH);
if(ch=="L")
digitalWrite(13,LOW);

// put your main code here, to run repeatedly:

}