Skip to main content

Seeed Studio XIAO nRF52840 (Sense) 上的 NFC 使用方法

note

Seeed nRF52 Boards 版本 1.1.3 和 Seeed nRF52 mbed-enabled Boards 版本 2.9.2 已经过测试和验证。

Seeed Studio XIAO nRF52840Seeed Studio XIAO nRF52840 Sense 都配备了 NFC(近场通信)模块。本 wiki 将帮助您开始在这些开发板上使用 NFC。在这里,我们将演示一个基本示例,在将手机放置在 NFC 天线上后,从开发板向手机发送文本字符串。

准备工作

当我们使用"Seeed nRF52 mbed-enabled Boards Library"时,NFC 功能将表现良好。

有关开发板库的安装,请参考此教程完成安装。如果您已经安装完成,我们可以继续进行项目。

所需硬件

所需软件

硬件连接

将 NFC 天线焊接到 Seeed Studio XIAO nRF52840 (Sense),如下所示:

pir

使用 NFC 发送文本字符串

  • 步骤 1. 打开 Arduino IDE 并上传以下代码
#include <NFCT.h>

void setup() {
// set the NFC message as first parameter and the language code as second
NFC.setTXTmessage("Hello World!", "en");
// start the NFC module
NFC.start();
}

void loop() {
}

在这里我们简单地发送文本字符串"Hello World!"

  • 步骤 2. 打开"NFC TagInfo"手机应用程序并点击 Scan & Launch

pir

  • 步骤 3. 将 NFC 天线靠近手机,您将看到以下输出

pir

Loading Comments...