fix default_keys example for avoid skipping first key
This commit is contained in:
@@ -82,11 +82,6 @@ bool try_key(MFRC522::MIFARE_Key *key)
|
|||||||
byte block = 0;
|
byte block = 0;
|
||||||
MFRC522::StatusCode status;
|
MFRC522::StatusCode status;
|
||||||
|
|
||||||
// http://arduino.stackexchange.com/a/14316
|
|
||||||
if ( ! mfrc522.PICC_IsNewCardPresent())
|
|
||||||
return false;
|
|
||||||
if ( ! mfrc522.PICC_ReadCardSerial())
|
|
||||||
return false;
|
|
||||||
// Serial.println(F("Authenticating using key A..."));
|
// Serial.println(F("Authenticating using key A..."));
|
||||||
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, block, key, &(mfrc522.uid));
|
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, block, key, &(mfrc522.uid));
|
||||||
if (status != MFRC522::STATUS_OK) {
|
if (status != MFRC522::STATUS_OK) {
|
||||||
@@ -153,5 +148,11 @@ void loop() {
|
|||||||
// no need to try other keys for this PICC
|
// no need to try other keys for this PICC
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// http://arduino.stackexchange.com/a/14316
|
||||||
|
if ( ! mfrc522.PICC_IsNewCardPresent())
|
||||||
|
break;
|
||||||
|
if ( ! mfrc522.PICC_ReadCardSerial())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user