Ameba Arduino: [RTL8195AM] NFC - Open a webpage on smartphone using NFC connection
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.
- Ameba x 1
- Smartphone with NFC feature x 1
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:
Next, make sure the NFC feature of the smartphone is turned on:
If NFC is turned on, the NFC icon appears in the status bar:
Then open the example, “File” -> “Examples” -> “AmebaNFC” -> “UriWebPage”
Compile and upload to Ameba, then press the reset button.
Bring the back of the smartphone close to the NFC antenna of Ameba.
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.
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).
Next use NFC.begin() to start the NFC module.