Skip to content

Instantly share code, notes, and snippets.

@beyazitkolemen
Created February 2, 2020 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beyazitkolemen/49f18a18644a592cda122295f8d5cfec to your computer and use it in GitHub Desktop.
Save beyazitkolemen/49f18a18644a592cda122295f8d5cfec to your computer and use it in GitHub Desktop.
rdm 6300 multi rfid reader
char data1;
char data2;
String newtag;
String newtag2;
void setup() {
// Note the format for setting a serial port is as follows: Serial2.begin(baud-rate, protocol, RX pin, TX pin);
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, 22, 4);
Serial1.begin(9600, SERIAL_8N1, 23, 5);
}
void loop() { //Choose Serial1 or Serial2 as required
newtag = "";
newtag2 = "";
while (Serial2.available()) {
for (int z = 0 ; z < 14 ; z++) // read the rest of the tag
{
data1 = Serial2.read();
newtag += data1;
}
String msg = newtag.substring(5, 11);
long decimal_answer = strtol(msg.c_str(), NULL, 16);
Serial.println(msg);
Serial.println(decimal_answer);
Serial2.flush();
}
while (Serial1.available()) {
for (int g = 0 ; g < 14 ; g++) // read the rest of the tag
{
data2 = Serial1.read();
newtag2 += data2;
}
String msg2 = newtag2.substring(5, 11);
long decimal_answer2 = strtol(msg2.c_str(), NULL, 16);
Serial.println(msg2);
Serial.println(decimal_answer2);
Serial1.flush();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment