Page 30 - MDP2022-2
P. 30

while  (1);  //  halt
                }
                //  Got  ok  data,  print  it  out!
                Serial.print("Found  chip  PN5");  Serial.println((versiondata  >>  24)  &  0xFF,  HEX);
                Serial.print("Firmware  ver.  ");  Serial.print((versiondata  >>  16)  &  0xFF,  DEC);
                Serial.print('.');  Serial.println((versiondata  >>  8)  &  0xFF,  DEC);


                //  configure  board  to  read  RFID  tags
                nfc.SAMConfig();
            }


            void  NFC_USE()  {
                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  ISO
            14443A  card  type)


                success  =  nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A,  uid,  &uidLength);


                if  (success)  {
                    //  Display  some  basic  information  about  the  card
                    Serial.print("Found  an  ISO14443A  card");


                    if  (uidLength  ==  4)
                    {
                        hexString  =  "";
                        for  (int  i  =  0;  i  <  uidLength;  i++)  {
                            hexString  +=  String(uid[i]  /  16,  HEX);
                            hexString  +=  String(uid[i]  %  16,  HEX);
                        }
                        mp3_play(1);
                        uid_1  =  hexString[0];
                        uid_2  =  hexString[1];
                        uid_3  =  hexString[2];
                        uid_4  =  hexString[3];
                        uid_5  =  hexString[4];
                        uid_6  =  hexString[5];
                        uid_7  =  hexString[6];
                        uid_8  =  hexString[7];
                        hexString  =  "00000000";


                        nfc.PrintHexChar(uid,  uidLength);
                        flag  =  1;
                    }
                }
   25   26   27   28   29   30   31   32   33   34   35