How to return the value of a RFID card (with the actual numbers/letters)

How do i return the value of the RFID card (with the actual numbers/letters) using simple code? I am using the sparkfun RFID starter kit and have attached the RFID reader to the Arduino using the TX pin. I am hoping that when i place the RFID card within range of the reader it will print out the id of the card (on screen). Eventually I am hoping to use this information so that when it senses that a specific ID card is read (this is where i will use the ID of the card) the Arduino will complete an action like turn a servo and/or blink a light. I am new to code and the simpler the better.

Thanks, Lucas

I have never played with RFID readers, but the code should be very simple:

while(Serial.available()) Serial.write(Serial.read());

What it does is checks for un-read data in the serial buffer. While there is still data sitting there un-read, it will continue reading it, then print it to the serial port. This returns the card value to the serial port. Without more info about the reader, this is all the help I can offer.

Onions.

have attached the RFID reader to the Arduino using the TX pin.

This should be the RX pin, the arduino needs to read the value from the RFID reader.

Problem with that code is that the RFID uses some non printing ASCII characters so you will never see them.

You need to use NewSoftware serial to receive the card data and the built in serial print to send it to the monitor.

Interesting, thanks for all of the help! I am still kinda lost on the code and i am not sure how to import the newSoftSerial library (i have downloaded it though). I have used eclipse and xcode but the Arduino seems completely different. When i tried to "add file" it seemed to add a whole different project. I am hoping to get to the point where i have a if statement where i say something like:

if(rfidCard = 4500B8F21B14) { //rotate servo... }

thanks a ton for all of the help! Lucas

You need to collect the individual chars and if you have enough you can do your thing

(code not complete)

#define MAXDIGITS 10   // or 8 or 11 or 137 ... ?

char rfid[MAXDIGITS+1];

void loop()
{
  // READ RFID
  int digits = 0;
  if (Serial.available() > 0) 
  {
    rfid[digits] = Serial.Read();
    digits++;
    rfid[digits] = '\0'; // keep string terminated , can be done smarter but this is robust for the debugging print below
  }
  Serial.println(rfid);

  // ALL READ
  if (digits == MAXDIGITS)
  {
    Serial.print("Found: "); Serial.println(rfid);
    doYourThing();
    digits = 0;  //resets for next 
  }
}

hopes this helps

Awesome! Thanks for all of the help. Together with some of the code you gave me and some other pieces of code i now have a working RFID controlled servo! Now all i have to do is figure out why i am having upload problems (even though the code is fine it says it is having issues with the upload process).

Thanks again for all of the help!
Lucas

Press the shift key while uploading and you get a lot more info about the process.

The RFID board must be disconnected when you upload to the arduino. Maybe that's your issue. Stuf connected to the serial pins will mess up uploads, giving you the stk500: not in sync error, I think