I know many people have asked this before, but I still need help.
RFID datasheet:
http://www.parallax.com/Portals/0/Downloads/docs/prod/rf/28440-RFIDReadWrite-v1.0.pdfEM-4100 Card :
http://www.parallax.com/Store/Accessories/CommunicationRF/tabid/161/ProductID/115/List/0/Default.aspx?SortField=ProductName,ProductNameI have followed the tutorial on
http://arduino.cc/playground/Learning/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
Please help. Thanks