wrong output arduino 125Khz

hi, i'm having some problem with the output, when reading a RFID tag.

here's my code:

#include <NewSoftSerial.h>

#define ADD_TAG_CODE "0010424562"  //change this ID with your own card TAG
#define DEL_TAG_CODE "210014E2BD6A"

NewSoftSerial RFID(2, 3);
String msg;
String ID ;  //string to store allowed cards

void setup()  
{
  Serial.begin(9600);
  Serial.println("Serial Ready");

  RFID.begin(9600);
  Serial.println("RFID Ready");
}

char c;

void loop(){
  
  while(RFID.available()>0){
    c=RFID.read(); 
    msg += c;
    Serial.println(int(RFID.read()));  //Uncomment to view your tag ID
    //Serial.println(msg.length());
  }
  msg=msg.substring(1,13);
  if(msg.indexOf(ADD_TAG_CODE)>=0) add(); 
  else if(msg.indexOf(DEL_TAG_CODE)>=0) del();  
  else if(msg.length()>10) verifica();
  msg="";
  
}

void add(){
  Serial.print("What TAG do you wanna grant access?: ");
  msg="";
  while(msg.length()<13){
    while(RFID.available()>0){
      c=RFID.read(); 
      msg += c;
    }
  }
  if(ID.indexOf(msg)>=0) {
    Serial.println("\nAccess already granted for this card.");
    msg="";
  }
  else{
    Serial.print("Card: ");
    Serial.println(msg); 
    ID += msg;
    ID += ",";
    //Serial.print("ID: ");
   // Serial.println(ID);
    msg="";
    Serial.println("Access granted for this card.");
  }

}

void del(){
  msg="";
  Serial.print("What TAG do you wanna deny access?: ");
  while(msg.length()<13){
    while(RFID.available()>0){
      c=RFID.read(); 
      msg += c;
    }
  }
  msg=msg.substring(1,13);
  if(ID.indexOf(msg)>=0){
    Serial.println(msg);
    Serial.println("TAG found. Access for this card denied.");
    //ID.replace(card,"");
    int pos=ID.indexOf(msg);
    msg="";
    msg += ID.substring(0,pos);
    msg += ID.substring(pos+15,ID.length());
    ID="";
    ID += msg;
    //Serial.print("ID: ");
    //Serial.println(ID);
  } else Serial.println("\nTAG not found or already denied");
  msg="";
}

void verifica(){
    msg=msg.substring(1,13);
    if(ID.indexOf(msg)>=0) Serial.println("Access granted.");
    else Serial.println("Access denied.");
}

i get this returned:

255
255
255
255
255
255
255
255
255
255
-1

I dont' understand it. The wiring is correct i think. Can't think about anything going wrong.

Are you saying it doesn't even print 'Serial Ready'?
That is strange.

it says:

Serial Ready
RFID Ready

so it does, but after that.. it doesn't give anything normal. Have two.. tried the other one.. but still nothing normal.

so it does, but after that.. it doesn't give anything normal. Have two.. tried the other one.. but still nothing normal.

What does this mean? What is "normal"? What output are you getting?

  while(RFID.available()>0){
    c=RFID.read();
    msg += c;
    Serial.println(int(RFID.read()));  //Uncomment to view your tag ID
    //Serial.println(msg.length());
  }

With that line uncommented, you are reading another character from the RFID reader, and then throwing it away. What you should be printing is the character you just read, not the next one.

There is nothing in this loop to ensure that you read a complete tag.

  msg=msg.substring(1,13);
  if(msg.indexOf(ADD_TAG_CODE)>=0) add();
  else if(msg.indexOf(DEL_TAG_CODE)>=0) del();
  else if(msg.length()>10) verifica();
  msg="";

This code assumes that you HAVE read a complete tag. What happens if you have only read 8 of the 13 characters?

Hi, i've solved this problem. I don't understand what happend :S but it works now.

i'm receiving it in Processing and get the ID like this for people who ar curious :

void serialDraw() {
  int lengthID = 0;
  while (myPort.available () > 0) {
    int inByte = myPort.read();
    lengthID++;
    Character idReceive = char(inByte);
    idTag = append(idTag, idReceive.toString());
    // idTag = append(idTag, Integer.parseInt(s));
    // println(char(inByte)+" "+lengthID);
  }

  if (myPort.available() <= 0) {
    if (idTag.length >5) {
      String joinTag = join(idTag, ""); 
      tagList = append(tagList, joinTag);

      idTag = new String[0];
    }
    println(tagList);
    //   lengthID = 0;
  }
}

Thanx!