This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.

Dependencies:   NDefLib X_NUCLEO_NFC01A1 mbed

Fork of X-MBED-NFC1 by Giovanni Visentini

This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.

The available demos are:

  • SAMPLE_WRITE_URL: write a tag with the ST home page URL
  • SAMPLE_COUNT_CLICK: create a custom tag to count and report the user button clicks.
  • SAMPLE_WRITE_AND_CHANGE_ALL: write a tag with all the supported records and update the tag contents when the user button is pressed.
  • SAMPLE_LOCK_TAG_CONTENT: use the M24SR component API to set the NFC tag as read-only.

To enable the different demos comment/uncomment the SAMPLE_* macros provided in main.cpp .

Revision:
15:94c98d2aa235
Parent:
14:3b604972b89f
Child:
17:d8d3d2088cac
--- a/Samples/SampleAsync_writeAndChangeAll.cpp	Wed Aug 31 13:06:13 2016 +0000
+++ b/Samples/SampleAsync_writeAndChangeAll.cpp	Wed Aug 31 13:58:17 2016 +0000
@@ -138,7 +138,7 @@
             break;}
         case Record::TYPE_URI:{
             RecordURI *temp = (RecordURI*)r;
-            temp->setContent("google.it");
+            temp->setContent("mbed.com");
             break;}
         case Record::TYPE_URI_MAIL:{
             RecordMail *temp = (RecordMail*)r;
@@ -210,6 +210,7 @@
 			delete mMsg;
 			return onFinish("Error Reading\r\n");
 		}else{
+			printf("Message Read\r\n\n");
 			for(uint32_t i=0;i<readMsg->getNRecords();i++){
 				NDefLib::Record *r = (*readMsg)[i];
 				printRecord(r);
@@ -289,7 +290,9 @@
 			printf("Error Reading\r\n");
 			deleteMessage();
 		}else{
+			printf("Message Read: change message content\r\n");
 			changeContent(readMsg);
+			printf("Start write new message\r\n");
 			tag->write(*mMsg);
 		}//if-else
 	}
@@ -300,9 +303,10 @@
 	virtual void onMessageWrite(NDefLib::NDefNfcTag *tag,bool success,
 							const NDefLib::Message &){
 		deleteMessage();
-		if(success)
+		if(success){
+			printf("Message Wrote\r\n");
 			tag->closeSession();
-		else
+		}else
 			printf("Error Writing\r\n");
 	}//onMessageWrite
 
@@ -345,6 +349,8 @@
 			return;
 		}//else
 
+		printf("Session open\r\n");
+
 		//create the message
 		 NDefLib::Message msg;
 
@@ -403,6 +409,7 @@
 		if(!success)
 			printf("Error Writing\r\n");
 
+		printf("Message wrote\r\n");
 		tag->closeSession();
 	}
 
@@ -421,7 +428,7 @@
 };
 
 
-static volatile bool buttonPress=false; /// true when the user press the message
+static bool buttonPress=false; /// true when the user press the message
 
 /**
  * Call back called when the user press the button