Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <SPI.h>
- #include <Adafruit_PN532.h>
- #define PN532_SCK (13)
- #define PN532_MOSI (11)
- #define PN532_SS (10)
- #define PN532_MISO (12)
- Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);
- void setup(void) {
- Serial.begin(230400);
- nfc.begin();
- uint32_t versiondata = nfc.getFirmwareVersion();
- if (! versiondata) {
- Serial.print("Didn't find PN53x board");
- while (1);
- }
- Serial.print("GET PN532");
- Serial.println((versiondata>>24) & 0xFF, HEX);
- nfc.SAMConfig();
- }
- void loop()
- {
- bool success;
- // set shield to inListPassiveTarget
- success = nfc.inListPassiveTarget();
- if(success) {
- uint8_t selectApdu[] = {0x00, 0xA4, 0x04, 0x00, 0x0E, 0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31, 0x00};
- uint8_t response[255];
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x00, 0xA4, 0x04, 0x00, 0x07, 0xA0, 0x00, 0x00, 0x00, 0x04, 0x10, 0x10, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x00, 0xB2, 0x01, 0x0C, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x00, 0xB2, 0x02, 0x14, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x00, 0xB2, 0x03, 0x14, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x00, 0xB2, 0x04, 0x14, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x00, 0xB2, 0x05, 0x14, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x00, 0xB2, 0x06, 0x14, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- uint8_t selectApdu[] = {0x80, 0xAE, 0x90, 0x00, 0x42, 0x00, 0x00, 0x00, 0x01, 0x79, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x43, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x43, 0x18, 0x01, 0x31, 0x00, 0x5E, 0x06, 0x39, 0xAE, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- memset(response, 0, sizeof(response));
- uint8_t responseLength = sizeof(response);
- success = nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength);
- if(success) {
- Serial.print("responseLength: "); Serial.println(responseLength);
- nfc.PrintHexChar(response, responseLength);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement