Go Down

Topic: RFID, interpreting data. (Read 422 times) previous topic - next topic

gravebond

I have an ID12 RFID reader working with my arduino duemilanove - ie it is lighting the led when a tag is read and is outputting the correct serial information.

Im using the code from here:
http://www.arduino.cc/playground/Code/ID12

My question is how do i use the data to turn an led a certain colour for example. so i want to add a function like

if (code = 2800C4DCIF){
digitalWrite (LED1, HIGH); }


I need to convert the data its giving me but i dont know how to convert it or what to convert it to. A simple explanation of what i need to do would be brilliant. I think i need to convert it to a string or parse it or something. Im not sure so an example would be great.

Thanks

IlBaboomba

#1
Mar 27, 2010, 11:05 am Last Edit: Mar 27, 2010, 11:07 am by Alexthebest Reason: 1
Code: [Select]
byte tag_verified[num_of_tags][6] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0x01, 0x01, 0x01, 0x01, 0x01, 0x01}}; //here put your tags



at the end of the code you found on the playground, (where it writes checksum passed or error)
put something like this:

Code: [Select]

byte i, current, verified = 0;
 for (current = 0; current < num_of_tags; current++){
   for (i = 0; i <= 5; i ++){
     if (code[i] != tag[current][i])
       break;
     if (i == 5 && (code[i] == tag[current][i]))
       verified = 1;
   }
   if (verified == 1)
     // put here your instructions
   break;
 }



Go Up