HarwareSerial.h

One question about your code (removed your comments)

#include<NewSoftSerial.h>  
NewSoftSerial mySerial(2,3); 
 
char c;  

void setup()
{
  Serial.begin(9600);  
  mySerial.begin(9600);  
}

void loop()
{
  Serial.Print("Key1"); //(1) <<<<<<<<<<<<<<
  delay(1000);
  if (mySerial.available() > 0)
  {
    c=mySerial.Read(); // (2) <<<<<<<<<<<<<<<<
    delay(1000);
  }
}

So you (1) print 4 characters over hardware serial and (2) read only one in software serial and you do nothing with it.

What do you expect to happen?


void loop()
{
Serial.[color=red]myPrint[/color]("Key1"); //does not exist!!!     mySerial.print("key1") might compile
delay(1000);
if(Serial.available()>0)
  {
   c=Serial.Read(); 
   delay(1000);
  }
}

for the rest same problem as before.

At least if you send 4 chars you need to read 4 chars.