Basically I’m trying to interface the M10 with the arduino I was wondering if anyone had more knowledge than I with RFID and arduino. I am using Software Serial to try and send messages to the reader so pin2 is RX and pin3 is TX. my problem is I’m having trouble sending those messages or determining what exactly im sending. I have the Tx and Rx crossed ground connected to ground and voltage to voltage. the hardware isn’t particularly the issue I was just curious if anyone could shed some light on the programming aspect.
Code :
#include <SoftwareSerial.h>
char Data = ‘0008002101010000F35E’;
char TagFail =‘00048101E7FC’;
char Val1;
char Val2;
const int LedPin = 13;
SoftwareSerial mySerial(2, 3); // RX, TX
SoftwareSerial OutPutSerial(5, 6 );
void setup()
{
pinMode(LedPin, OUTPUT);
Serial.begin(57600);
Serial.println(“Set”);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println(Data);
}
void loop()
{
if (mySerial.available())
Val1 = Serial.write(mySerial.read());
delay(500);
if (Serial.available())
Val2 = mySerial.write(Serial.read());
delay(500);
if(Val1==Data || Val2==Data)
{
digitalWrite(LedPin, HIGH);
delay(5000);
}
if(Val1==TagFail || Val2==TagFail)
{
digitalWrite(LedPin, HIGH);
delay(2000);
digitalWrite(LedPin, LOW);
delay(2000);
digitalWrite(LedPin, HIGH);
delay(2000);
digitalWrite(LedPin, LOW);
delay(2000);
}
else
{
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
}
}
Problem 1 : How can I read the data I receive/Send without interfering with the serial ports ?
Problem 2 : Do I need to specify the number of bytes that I am trying to receive/send through serial?
Problem 3 : Is there any specific code that I am missing or other fucntions I need to include for this to function properly?
Any help with software Serial is much appreciated I am confused on exactly how it works I’ve done the tutorials with 2 arduinos and watched videos but I still don’t quite get it.