我正在使用Arduino Uno和adaFruit PN532板。我们的目标是能够创建一个当前位于NFC Shield范围内的MiFare卡列表。用arduino创建找到的Mifare标签列表?
我很难找出编写这个逻辑的最佳方法,因为这个板子似乎只在每个循环中检测到一张卡片。
我可以在电路板上放置两张卡,它可以看到它们两个,但每个回路只有一个卡。所以如何将我去创造什么是目前在范围内的电流列表
我的循环:
void loop()
{
Serial.println("--------------------Loop begin-------------------");
uint8_t success;
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID
uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
uint8_t index =0;
// Wait for an ISO14443A type cards (Mifare, etc.). When one is found
// 'uid' will be populated with the UID, and uidLength will indicate
// if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
if (success) {
// Display some basic information about the card
Serial.println("Found an ISO14443A card");
Serial.print(" UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
Serial.print(" UID Value: ");
nfc.PrintHex(uid, uidLength);
Serial.println("");
}
Serial.println("************************Loop END*********************");
}
,这里是串行监控出来的时候在范围两张卡:
--------------------循环开始-------------------
找到一个ISO14443A卡
UID长度:4个字节
UID值:0×13 0x99为0x1C 0xD4**********************循环结束***** **************
-------------------- Loop begin --------- ----------
实测值的ISO14443A卡
UID长度:4个字节
UID值:0×13 0×27 0x34 0xD4************* *********循环E ND *******************