//EM-18 RFID Module interfacing with LinkIt ONE uint8_t count=0; //counter for RFID card number reading char RFID_input[12]; // character array of size 12 to store the Tag ID being presented char tagOk[] ="1500239EA50D"; // Replace with your wanted Tag ID void setup() { // put your setup code here, to run once: Serial.begin(9600); //For serial debugging on laptop/computer Serial1.begin(9600); //RFID card is connected } void loop() { count=0; while(count<12 && Serial1.available()) { RFIDRead_Check(); } } void RFIDRead_Check() { count = 0; while(Serial1.available() && count < 12) // Read 12 characters and store them in input array { RFID_input[count++] = Serial1.read(); } Serial.print(RFID_input); // Print RFID tag number if (count==12) { Serial.println("Checking whether the RFID number read is error free or not!!"); if((RFID_input[0] ^ RFID_input[2] ^ RFID_input[4] ^ RFID_input[6] ^ RFID_input[8] == RFID_input[10]) && (RFID_input[1] ^ RFID_input[3] ^ RFID_input[5] ^ RFID_input[7] ^ RFID_input[9] == RFID_input[11])) { Serial.println("The RFID number read is error free"); RFID_authorize(); } else { Serial.println("error in reading RFID number"); } } } void RFID_authorize() { int compare = 1; compare = (strncmp(tagOk, RFID_input,12)) ; // if both tags are equal strncmp returns a 0 if (compare == 0) { Serial.println("The RFID number read is of authorize person"); } else { Serial.println("The RFID number read is of un-authorize person"); } }