Pages: [1]   Go Down
Author Topic: RFID reader received XXxxx 000  (Read 379 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All,

          I had just received my Parallex RFID reader and connected them to my Arduino Uno with

Arduino RX to RFID SOUT
Arduino GND to RFID GND
Arduino Digital pin 2 to RFID /Enable
Arduino +5V to RFID Vcc pin.

          However when I run the code in the forum, I got XXxx 00 as shown at the bottom of the post and not the card number. BTW I am using the 2 cards that come together with the RFID reader. I do not know what happen. Anyone can advise? Thanks a lot

http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/rfid/List/1/ProductID/114/Default.aspx?SortField=ProductName%2cProductName

Code:
// RFID reader for Arduino
// Wiring version by BARRAGAN <http://people.interaction-ivrea.it/h.barragan>
// Modified for Arudino by djmatic


int  val = 0;
char code[10];
int bytesread = 0;

void setup() {

Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps
pinMode(2,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
digitalWrite(2, LOW);                  // Activate the RFID reader



 void loop() {

  if(Serial.available() > 0) {          // if data available from reader
    if((val = Serial.read()) == 10) {   // check for header
      bytesread = 0;
      while(bytesread<10) {              // read 10 digit code
        if( Serial.available() > 0) {
          val = Serial.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;
      digitalWrite(2, HIGH);                  // deactivate the RFID reader for a moment so it will not flood
           delay(1500);                       // wait for a bit
           digitalWrite(2, LOW);                  // Activate the RFID reader
    }
  }
}

// extra stuff
// digitalWrite(2, HIGH);             // deactivate RFID reader

Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 80
Posts: 1726
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
Serial.begin(2400);

Look at the bottom right of the arduino Serial Monitor, and tell me what is wrong  smiley.
« Last Edit: December 28, 2012, 08:16:57 am by Tom Carpenter » Logged

~Tom~

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oops,

          Sorry. I dont know that I need to still set the serial monitor. I thought serial.begin(2400) will do the job...hahaha
Logged

Pages: [1]   Go Up
Jump to: