RC522 Module and MFRC522 Library How to know PICC still present
hello,
i trying find out if picc (rfid tag) still present on mfrc522 rfid reader.
i can't understand how wakeupa command works.
library here : https://github.com/miguelbalboa/rfid/
full code here : https://github.com/omersiar/rfid522-door-unlock/blob/master/rfiddoorunlock205.ino
i getting uid this;
and program looks eeprom if readcard known or not. if known card want run program
1 wake picc halted
2 if picc still on reader nothing (return 0)
3 else main loop (return 1)
i tried checking uid again , again, seemed stupid because of eeprom wears out
thank suggestions.
i trying find out if picc (rfid tag) still present on mfrc522 rfid reader.
code: [select]
/**
* transmits wake-up command, type a. invites piccs in state idle , halt go ready(*) , prepare anticollision or selection. 7 bit frame.
* beware: when 2 piccs in field @ same time status_timeout - due bad antenna design.
*
* @return status_ok on success, status_??? otherwise.
*/
byte mfrc522::picc_wakeupa( byte *bufferatqa, ///< buffer store atqa (answer request) in
byte *buffersize ///< buffer size, @ least 2 bytes. number of bytes returned if status_ok.
) {
return picc_reqa_or_wupa(picc_cmd_wupa, bufferatqa, buffersize);
} // end picc_wakeupa()
i can't understand how wakeupa command works.
library here : https://github.com/miguelbalboa/rfid/
full code here : https://github.com/omersiar/rfid522-door-unlock/blob/master/rfiddoorunlock205.ino
i getting uid this;
code: [select]
int getid() {
if ( ! mfrc522.picc_isnewcardpresent()) { //if new picc placed rfid reader continue
return 0;
}
if ( ! mfrc522.picc_readcardserial()) { //since picc placed serial , continue
return 0;
}
(int = 0; < mfrc522.uid.size; i++) { // size of uid.size write uid.uidbyte readcard
readcard[i] = mfrc522.uid.uidbyte[i];
}
mfrc522.picc_halta(); // stop reading
return 1;
}
and program looks eeprom if readcard known or not. if known card want run program
1 wake picc halted
2 if picc still on reader nothing (return 0)
3 else main loop (return 1)
code: [select]
void relayon() {
{
still = stillpresent();
delay(1000);
}
while (!still); // nothing until picc removed
}
int stillpresent() {
1 ????
2 ????
3 ????
}
i tried checking uid again , again, seemed stupid because of eeprom wears out
thank suggestions.
quote
i tried checking uid again , again, seemed stupid because of eeprom wears out
writing eeprom wears out. reading not. of course, neither necessary. write when there new data (that value write different there now). read once , remember read.
quote
i can't understand how wakeupa command works.
does matter understand it? presumably, interested in having function something. so, call it.
not understanding arguments needs different story. argument type known - pointer byte - means need define byte array function store data. data may, or more likely, may not, of interest. size of array you, comment suggests 2 bytes minimum, suggests function writes "ok" or "ko" there, depending on ability perform requested function. try 10 byte array, first. see function writes array. then, adjust size of array if needed.
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > RC522 Module and MFRC522 Library How to know PICC still present
arduino
Comments
Post a Comment