NFC - Open a webpage on smartphone using NFC connection

Many models of Android smart phone support NFC feature, and numerous of NFC applications are developed for inspection and modification of NFC Tag.
In this example, we establish NFC connection between Ameba and a smartphone, and open a webpage on the smartphone via a NFC event. If you are not familiar with NFC, please read Introduction to NFC first.
 
Preparation
  • Ameba x 1
  • Smartphone with NFC feature x 1

Example

If we want to use NFC feature of Ameba, we have to first weld the NFC antenna on Ameba. As shown in the figure below:

1

Next, make sure the NFC feature of the smartphone is turned on:

2

If NFC is turned on, the NFC icon appears in the status bar: 3

Then open the example, “File” -> “Examples” -> “AmebaNFC” -> “UriWebPage”
4

Compile and upload to Ameba, then press the reset button.
Bring the back of the smartphone close to the NFC antenna of Ameba.
5

If the NFC connection is established successfully, some system might open the webpage directly, while some system pop an alert window to confirm whether you want to open the webpage.
6

Code Reference

The NFC API of Ameba provides the common NDEF Class. In the sample code, appendRtdUri() is used to set the webpage to be opened on the smartphone (the “http://www.” part is not needed).

NfcTag.appendRtdUri("amebaiot.com");

Next use NFC.begin() to start the NFC module.

Please confirm that QQ communication software is installed