PlatformIO ESP32经验
https://docs.platformio.org/en/latest/manifests/library-json/fields/dependencies.html
johboh/nlohmann-json
https://registry.platformio.org/libraries/johboh/nlohmann-json/installation1、Depend on it 安装库:通过platformio.ini文件添加 Open platformio.ini, a project configuration file located in the root of PlatformIO project. Add the following line to the lib_deps option of [env:] section: lib_deps = ArduinoJson johboh/nlohmann-json@^3.11.3 Build a project, PlatformIO will automatically install dependencies. 2、Include it 引入库 #include <nlohmann/json.hpp> using JSON = nlohmann::json; 3、Command Line Interface 安装库:通过命令行添加 Open PlatformIO Core CLI Change directory (cd) to the PlatformIO project where platformio.ini is located. Copy the following pio pkg install command and paste into the CLI shell, press Enter: pio pkg install --library "johboh/nlohmann-json@^3.11.3"
使用VS Code + PlatformIO安装“Adafruit PN532”和“Adafruit BusIO”库的具体操作指引:
安装“Adafruit PN532”库
-
打开VS Code:启动Visual Studio Code。
-
打开终端:在VS Code中,点击视图(View)>终端(Terminal),打开终端。
-
安装库:在终端中输入以下命令并回车:
pio lib install "Adafruit PN532"等待安装完成,安装过程中可能会显示一些进度信息。
安装“Adafruit BusIO”库
-
继续在终端操作:如果终端已经打开,可以直接在终端中继续操作。
-
安装库:在终端中输入以下命令并回车:
pio lib install "Adafruit BusIO"同样等待安装完成。
验证安装
-
检查库是否安装成功:在终端中输入以下命令:
pio lib list查看已安装的库列表,确认“Adafruit PN532”和“Adafruit BusIO”库是否在列表中。

浙公网安备 33010602011771号