## 什么是 PlatformIO PlatformIO 是一个开源的嵌入式开发平台,支持多种微控制器和开发板(如 Arduino、ESP32)。它集成了库管理、构建系统、调试和单元测试功能,可以在多种操作系统上运行,并与 VS Code 等流行的编辑器兼容。 PlatformIO 提供了一站式的开发工具,简化了嵌入式系统的开发流程。 ## 常用命令 - `pio device list` 查看设备列表 - `pio device monitor` 监视串口输出 - `pio boards esp32` 搜索 esp32 开发板 - `pio home` 打开 PlatformIO 管理后台,可以搜索库、管理项目和设备 - `pio pkg install --library xxx` 安装库 ## 测试运行 1. 创建目录 ```shell $ mkdir test $ cd test ``` 2. 初始化项目,指定硬件 `esp32-s3-devkitc-1` 使用 `Arduino` 框架进行开发 ```shell $ pio project init --board esp32-s3-devkitc-1 --project-option "framework=arduino" ``` 3. 编译上传并启动串口监视器 ```shell $ pio run --target upload $ pio device monitor -p /dev/cu.usbmodem574C0330521 -b 115200 -f direct ``` ## 参考 - https://docs.platformio.org/en/latest/what-is-platformio.html - https://docs.platformio.org/en/latest/core/index.html