I'm using the (id12 innovations) RFID read with a Raspberry Pi. Using the PI4J java library and it's serial example, I'm able to read some data like (5002CF13C6) i'm not sure what this data is! it suppose to get this number (0002948115).
here's is my code:
// create an instance of the serial communications class
final Serial serial = SerialFactory.createInstance();
// create and register the serial data listener
serial.addListener(new SerialDataListener() {
@Override
public void dataReceived(SerialDataEvent event) {
//-----------
System.out.print("\n" + event.getData());
//-----------
}
});
try {
// open the default serial port provided on the GPIO header
serial.open("/dev/ttyAMA0", 9600);
// continuous loop to keep the program running until the user terminates the program
for (;;) {
try {
} catch (IllegalStateException ex) {
ex.printStackTrace();
}
try {
// wait 1 second before continuing
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(Rfid.class.getName()).log(Level.SEVERE, null, ex);
}
}
} catch (SerialPortException ex) {
System.out.println("e: RFID setup failed : " + ex.getMessage());
}
what should i do to event.getData() in order to be able to read the real data?