Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "PN532.h" 00003 #include <string> 00004 00005 00006 DigitalOut led1(LED1); 00007 DigitalOut led2 (LED2); 00008 00009 00010 PN532 nfc(mosi1, miso1, sclk1, ss1); 00011 00012 int main() 00013 { 00014 printf("\r INITIATOR STARTED\n"); 00015 nfc.begin(); 00016 00017 00018 uint32_t versiondata = nfc.getFirmwareVersion(); 00019 if (! versiondata) { 00020 printf("Didn't find PN532\r\n"); 00021 00022 while (1) { 00023 led1 = !led1; 00024 wait(0.1); 00025 } 00026 } 00027 00028 printf("Found chip PN5%2X\r\n", versiondata >> 24); 00029 printf("Firmware V%d.%d\r\n", (versiondata >> 16) & 0xFF, (versiondata >> 8) & 0xFF); 00030 00031 00032 nfc.SAMConfig(); 00033 wait(1); 00034 00035 char dataOut[] = "hello target"; 00036 char dataIn[16]; 00037 00038 while (1) { 00039 if(nfc.configurePeerAsInitiator()==1) { 00040 printf("found target"); 00041 nfc.initiatorTxRx(dataOut, dataIn); 00042 printf("\n\r%s", dataIn); 00043 } else { 00044 printf("no target"); 00045 } 00046 led1=!led1; 00047 wait(1); 00048 } 00049 } 00050
Generated on Wed Jul 13 2022 10:41:14 by
1.7.2