Get value from RFID tag and store it as a string

Okay, I got it working for the most part. However, there is one huge problem. After the LCD displays the UID of the tag, the UID is replaced with some strange characters: each of them are decimal value 186. During that time, the code disables and re-enables the RFID reader. I did manage to use a longer time delay to get "Got some noise" to display instead of the strange characters. I have no idea what the crap is going on. I used Serial.println(tag*) to show what the LCD was trying to display, and those strange dec186 characters return a blank character in the serial monitor. Here is my code:*
```
*#define RFID_ENABLE 10  //to RFID ENABLE
#define CODE_LEN 10      //Max length of RFID tag
#define VALIDATE_TAG 1  //should we validate tag?
#define VALIDATE_LENGTH  200 //maximum reads b/w tag read and validate
#define ITERATION_LENGTH 5000 //time, in ms, given to the user to move hand away
#define START_BYTE 0x0A
#define STOP_BYTE 0x0D
#define green 12
#define red 13

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
//LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(2, 3, 5, 6, 7, 8);

char tag[CODE_LEN];

void setup() {
  Serial.begin(2400); 
  pinMode(RFID_ENABLE,OUTPUT); 
lcd.begin(16,2) ;
}

void loop() {
  enableRFID();
  delay(100);
  lcd.clear();
  lcd.print("TAG:");
  getRFIDTag();
  if(isCodeValid()) {
    disableRFID();
    sendCode();
    delay(ITERATION_LENGTH);
  } else {
    disableRFID();
    lcd.clear();
    lcd.print("Got some noise"); 
  }
  Serial.flush();
  clearCode();
}

/**

  • Clears out the memory space for the tag to 0s.
    */
    void clearCode() {
      for(int i=0; i<CODE_LEN; i++) {
        tag[i] = 0;
      }
    }

/**

/***/
/
  RFID Functions  /
/
/

void enableRFID() {
  digitalWrite(RFID_ENABLE, LOW);
  digitalWrite(red, HIGH);digitalWrite(green,LOW);
}

void disableRFID() {
  digitalWrite(RFID_ENABLE, HIGH); 
  digitalWrite(red, LOW);digitalWrite(green,HIGH);
}

/**

  • Blocking function, waits for and gets the RFID tag.
    */
    void getRFIDTag() {
      byte next_byte;
      while(Serial.available() <= 0) {}
      if((next_byte = Serial.read()) == START_BYTE) {     
        byte bytesread = 0;
        while(bytesread < CODE_LEN) {
          if(Serial.available() > 0) { //wait for the next byte
              if((next_byte = Serial.read()) == STOP_BYTE) break;     
              tag[bytesread++] = next_byte;                 
          }
        }               
      }   
    }

/**

  • Waits for the next incoming tag to see if it matches
  • the current tag.
    /
    boolean isCodeValid() {
      byte next_byte;
      int count = 0;
      while (Serial.available() < 2) {  //there is already a STOP_BYTE in buffer
        delay(1); //probably not a very pure millisecond
        if(count++ > VALIDATE_LENGTH) return false;
      }
      Serial.read(); //throw away extra STOP_BYTE
      if ((next_byte = Serial.read()) == START_BYTE) { 
        byte bytes_read = 0;
        while (bytes_read < CODE_LEN) {
          if (Serial.available() > 0) { //wait for the next byte     
              if ((next_byte = Serial.read()) == STOP_BYTE) break;
              if (tag[bytes_read++] != next_byte) return false;                   
          }
        }               
      }
      return true;  }

    ```