Shop OBEX P1 Docs P2 Docs Learn Events
arduino to Parallax rfid read/write module interfaciing....??? — Parallax Forums

arduino to Parallax rfid read/write module interfaciing....???

alexkuletalexkulet Posts: 9
edited 2012-02-23 21:26 in Accessories
hello everyone.. i'm newbie in this forum... and i just wanna ask how to interface the arduino 328 to parallax rfid read/write module..??? i tried several codes from the net but nothings happen.. i want to write in my tags but sad to say the codes didn't work....help please.....! thanks

Comments

  • alexkuletalexkulet Posts: 9
    edited 2012-02-23 21:26
    thanks for your reply .. but seem no luck.. i tried the codes in this site http://arduino.cc/playground/Learning/PRFID..... the light turns to read.. but no response to the serial monitor....what should i do.. help please here is the code for reading and newer EM4x50 tags....



    #include <SoftwareSerial.h>
    #define RFID_READ 0x01
    #define txPin 6
    #define rxPin 8
    SoftwareSerial mySerial(rxPin, txPin);
    int val;int runs = 0;
    void setup(){
    Serial.begin(9600);
    Serial.println("RFID Read/Write Test");
    mySerial.begin(9600);
    pinMode(txPin, OUTPUT);
    pinMode(rxPin, INPUT);
    }
    void suppressAll() //suppresses the "null result" from being printed if no RFID tag is present
    { if(mySerial.available() > 0)
    { mySerial.read(); suppressAll();
    }
    }
    void loop(){
    int val;
    mySerial.print("!RW");
    mySerial.write(byte(RFID_READ));
    mySerial.write(byte(32));
    if(mySerial.available() > 0)
    { val = mySerial.read(); //The mySerial.read() procedure is called, but the result is not printed because I don't want the "error message: 1" cluttering up the serial monitor
    if (val != 1) //If the error code is anything other than 1, then the RFID tag was not read correctly and any data collected is meaningless. In this case since we don't care about the resultant values they can be suppressed
    {suppressAll();
    }
    }
    if(mySerial.available() > 0)

    {
    val = mySerial.read();
    Serial.print("1st:");
    Serial.println(val, HEX);
    }
    if(mySerial.available() > 0)
    { val = mySerial.read();
    Serial.print("2nd:");
    Serial.println(val, HEX);
    }
    if(mySerial.available() > 0)
    {
    val = mySerial.read();
    Serial.print("3rd:");
    Serial.println(val, HEX);
    }
    if(mySerial.available() > 0)
    { val = mySerial.read();
    Serial.print("4th:");
    Serial.println(val, HEX);
    Serial.println("
    ");
    }
    delay(750);
    }












    ....does anyone works with this codes .....the compilation is correct but still no response,,,,,
Sign In or Register to comment.