Hello everyone.
I am studying the example sketch of the RDM6300 and from it try to make two RDM6300 readers work together in the same arduino.
I researched a lot and I’m finding it difficult on some points:
I noticed that the problem is in SoftwareSerial, and that in some posts I’ve seen some people recommend using Serial1, Serial2 and Serial3, instead of SoftwareSerial. But I really did not understand how!
below I put two attempts I had to make it work. So if anyone can help, first tell me the best method, how to do it and where I am wrong.
thankful!
method 1
/*
RFID RDM6300 data decoder library
(c) Stephane Driussi 20150623
Not for commercial use
Refer to rdm6300_decoder_wiring.jpg diagram for proper connection
*/
#include <SoftwareSerial.h>
#include <RDM6300.h>
SoftwareSerial RFID1(68, 67); // RX and TX
SoftwareSerial RFID2(66, 65); // RX and TX
int Led=13;
uint8_t Payload[6]; // used for read comparisons
RDM6300 RDM6300(Payload);
void setup()
{
pinMode(Led, OUTPUT);
RFID1.begin(9600); // start serial to RFID reader
RFID2.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
}
void loop()
{
RFID1.listen();
while (RFID1.available() > 0)
{
digitalWrite(Led, HIGH);
uint8_t c = RFID1.read();
//Serial.print(c,HEX);
if (RDM6300.decode(c)) {
for (int i=0; i < 5; i++){
Serial.print(Payload[i], HEX);
Serial.print(" ");
}
Serial.println();
}
}
RFID2.listen();
while (RFID2.available() > 0)
{
digitalWrite(Led, HIGH);
uint8_t c = RFID2.read();
//Serial.print(c,HEX);
if (RDM6300.decode(c)) {
for (int i=0; i < 5; i++){
Serial.print(Payload[i], HEX);
Serial.print(" ");
}
Serial.println();
}
}
digitalWrite(Led, LOW);
delay(100);
}
method 2
/*
RFID RDM6300 data decoder library
(c) Stephane Driussi 20150623
Not for commercial use
Refer to rdm6300_decoder_wiring.jpg diagram for proper connection
*/
#include <SoftwareSerial.h>
#include <RDM6300.h>
SoftwareSerial RFID1(68, 67); // RX and TX
SoftwareSerial RFID2(66, 65); // RX and TX
int Led=13;
uint8_t Payload[6]; // used for read comparisons
RDM6300 RDM6300(Payload);
void setup()
{
pinMode(Led, OUTPUT);
Serial1.begin(9600); // start serial to RFID reader
Serial2.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
}
void loop()
{
while (Serial1.available() > 0)
{
uint8_t c = RFID1.read();
//Serial.print(c,HEX);
if (RDM6300.decode(c)) {
for (int i=0; i < 5; i++){
Serial.print(Payload[i], HEX);
Serial.print(" ");
}
Serial.println();
}
}
while (Serial2.available() > 0)
{
uint8_t c = RFID2.read();
//Serial.print(c,HEX);
if (RDM6300.decode(c)) {
for (int i=0; i < 5; i++){
Serial.print(Payload[i], HEX);
Serial.print(" ");
}
Serial.println();
}
}
digitalWrite(Led, LOW);
delay(100);
}