diff --git a/libraries/pn532_spi.zip b/libraries/pn532_spi.zip new file mode 100644 index 0000000..b152b44 Binary files /dev/null and b/libraries/pn532_spi.zip differ diff --git a/libraries/vma211_spi.zip b/libraries/vma211_spi.zip new file mode 100644 index 0000000..280efe6 Binary files /dev/null and b/libraries/vma211_spi.zip differ diff --git a/main/main.ino b/main/main.ino index 95c2b6e..f929cc3 100644 --- a/main/main.ino +++ b/main/main.ino @@ -1,9 +1,43 @@ -void setup() { - // put your setup code here, to run once: +#include +#include +#define PN532_CS 10 + +PN532 nfc(PN532_CS); + +const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; +LiquidCrystal lcd(rs, en, d4, d5, d6, d7); + +void setup(void) { + nfc.begin(); + + uint32_t versiondata = nfc.getFirmwareVersion(); + if (! versiondata) { + while (1); // halt + } + // configure board to read RFID tags and cards + nfc.SAMConfig(); } -void loop() { - // put your main code here, to run repeatedly: +void loop(void) { + uint32_t id; + // look for MiFare type cards + id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A); + if (id != 0) + { + + uint8_t keys[]= { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF }; + if(nfc.authenticateBlock(1, id ,0x08,KEY_A,keys)) //authenticate block 0x08 + { + //if authentication successful + uint8_t block[16]; + //read memory block 0x08 + if(nfc.readMemoryBlock(1,0x08,block)) + { + + } + } + } + delay(1000); }