I have followed the tutorial on Arduino Playground - ParallaxRFIDreadwritemodule. The red led on the RFIG lighted up and the serial monitor displayed "RFID Read/Write Test". However, no matter how I tab the card, nothing happened.
For your convenience, the code is below:
#include <SoftwareSerial.h>
#define txPin 6
#define rxPin 8
#define RFID_LEGACY 0x0F
SoftwareSerial mySerial(rxPin, txPin);
int val = 0;
char code[11]; //Note this is 11 for the extra null char?
int bytesread = 0;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(txPin, OUTPUT); //pin 6
pinMode(rxPin, INPUT); //pin 8
Serial.println("RFID Read/Write Test");
}
void loop()
{
mySerial.print("!RW");
mySerial.write(byte(RFID_LEGACY));
//mySerial.print(32, BYTE);
if(mySerial.available() > 0) { // if data available from reader
if((val = mySerial.read()) == 10) { // check for header
bytesread = 0;
while(bytesread<10) { // read 10 digit code
if( mySerial.available() > 0) {
val = mySerial.read();
if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
break; // stop reading
}
code[bytesread] = val; // add the digit
bytesread++; // ready to read next digit
}
}
if(bytesread == 10) { // if 10 digit read is complete
Serial.print("TAG code is: "); // possibly a good TAG
Serial.println(code); // print the TAG code
}
bytesread = 0;
delay(500); // wait for a 1/2 second
}
}
}
NOTE I am using Arduino 1.0.1 software - NewSoftSerial and BYTE cannot work
Thanks for telling me, but I am at a loss right now, what can I do to get the RFID to work properly? Sorry to trouble you
I got to get to bed now, will be back in around 12 hours. Apologies
Hi PaulS
I just did some try outs here and I meraculously succeeded in getting the program to work.
Here's the story:
I decided to try out the program back at Arduino Playground - ParallaxRFIDreadwritemodule that reads the newer EM4x50 tags.
Again nothing happens when I scan the cards for obvious reasons.
So I used the first program again and somehow the whole thing works properly.
Probably the input wires were a little loose or there is a small mistake in the code when I tried to use it earlier. But everythings fine now.
Sorry for all the trouble I caused and thanks for trying to help me out.