跳至主要内容

ESP32 範例程式清單

framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.17

藍牙 (BLE) 示例

示例名稱功能描述開發工具適用晶片
BLE5_extended_scan演示 Bluetooth 5.0 的擴展廣播和掃描功能ESP-IDF / PlatformIOESP32 系列
BLE5_multi_advertising演示 Bluetooth 5.0 的多廣播功能ESP-IDF / PlatformIOESP32 系列
BLE5_periodic_advertising演示 Bluetooth 5.0 的週期性廣播功能ESP-IDF / PlatformIOESP32 系列
BLE5_periodic_sync演示 Bluetooth 5.0 的週期性同步功能ESP-IDF / PlatformIOESP32 系列
BLE_Beacon_Scanner實現 BLE 信標掃描器ESP-IDF / PlatformIOESP32 系列
BLE_EddystoneTLM_Beacon實現 Eddystone 遙測信標ESP-IDF / PlatformIOESP32 系列
BLE_EddystoneURL_Beacon實現 Eddystone URL 信標ESP-IDF / PlatformIOESP32 系列
BLE_client實現 BLE 客戶端功能ESP-IDF / PlatformIOESP32 系列
BLE_iBeacon實現 iBeacon 協議ESP-IDF / PlatformIOESP32 系列
BLE_notify演示 BLE 特徵值通知功能ESP-IDF / PlatformIOESP32 系列
BLE_scan實現基礎的 BLE 掃描功能ESP-IDF / PlatformIOESP32 系列
BLE_server實現 BLE 伺服器功能ESP-IDF / PlatformIOESP32 系列
BLE_server_multiconnect支持多設備同時連接的 BLE 伺服器ESP-IDF / PlatformIOESP32 系列
BLE_uart通過 BLE 實現串口通信ESP-IDF / PlatformIOESP32 系列
BLE_write演示 BLE 特徵值寫入功能ESP-IDF / PlatformIOESP32 系列

經典藍牙示例(不適用於 ESP32-S2, ESP32-C3, ESP32-S3)

示例名稱功能描述開發工具適用晶片
DiscoverConnect經典藍牙設備發現和連接ESP-IDF / PlatformIOESP32 系列
GetLocalMAC獲取本地藍牙 MAC 地址ESP-IDF / PlatformIOESP32 系列
SerialToSerialBT經典藍牙串口通信ESP-IDF / PlatformIOESP32 系列
SerialToSerialBTM經典藍牙多設備串口通信ESP-IDF / PlatformIOESP32 系列
SerialToSerialBT_SSP_pairing經典藍牙安全簡單配對ESP-IDF / PlatformIOESP32 系列
bt_classic_device_discovery經典藍牙設備發現ESP-IDF / PlatformIOESP32 系列
bt_remove_paired_devices刪除已配對的經典藍牙設備ESP-IDF / PlatformIOESP32 系列

Wi-Fi 示例

示例名稱功能描述開發工具適用晶片
FTM_Initiator實現 802.11 Fine Timing Measurement (FTM) 協議 - 作為發起方ESP-IDF / PlatformIOESP32-S2, ESP32-C3
FTM_Responder實現 802.11 Fine Timing Measurement (FTM) 協議 - 作為響應方ESP-IDF / PlatformIOESP32-S2, ESP32-C3
SimpleWiFiServer實現一個簡單的 Wi-Fi 伺服器ESP-IDF / PlatformIOESP32 系列
WPS實現 Wi-Fi Protected Setup (WPS) 配網ESP-IDF / PlatformIOESP32 系列, ESP32-S2
WiFiAccessPoint創建一個 Wi-Fi 接入點ESP-IDF / PlatformIOESP32 系列
WiFiBlueToothSwitch在 Wi-Fi 和藍牙之間切換ESP-IDF / PlatformIOESP32 系列
WiFiClient實現 Wi-Fi 客戶端功能ESP-IDF / PlatformIOESP32 系列
WiFiClientBasic實現基礎的 Wi-Fi 客戶端功能ESP-IDF / PlatformIOESP32 系列
WiFiClientConnect實現 Wi-Fi 客戶端自動重連功能ESP-IDF / PlatformIOESP32 系列
WiFiClientEnterprise實現 Wi-Fi 企業級連接ESP-IDF / PlatformIOESP32 系列
WiFiClientEvents監聽 Wi-Fi 客戶端事件ESP-IDF / PlatformIOESP32 系列
WiFiClientStaticIP設置 Wi-Fi 客戶端靜態 IPESP-IDF / PlatformIOESP32 系列
WiFiIPv6演示 IPv6 功能ESP-IDF / PlatformIOESP32 系列, ESP32-S2
WiFiMulti支持多個 Wi-Fi 網絡的切換ESP-IDF / PlatformIOESP32 系列
WiFiScan實現 Wi-Fi 網絡掃描功能ESP-IDF / PlatformIOESP32 系列
WiFiScanDualAntenna利用雙天線進行 Wi-Fi 掃描ESP-IDF / PlatformIOESP32 系列
WiFiSmartConfig實現 SmartConfig 配網功能ESP-IDF / PlatformIOESP32 系列
WiFiTelnetToSerial通過 Telnet 訪問 ESP32 串口ESP-IDF / PlatformIOESP32 系列, ESP32-S2
WiFiUDPClient實現 Wi-Fi UDP 客戶端功能ESP-IDF / PlatformIOESP32 系列

其他功能示例

示例類別功能描述開發工具適用晶片
AnalogOutDAC 模擬信號輸出ESP-IDF / PlatformIOESP32 系列
AnalogReadADC 模擬信號採集ESP-IDF / PlatformIOESP32 系列
Camera攝像頭拍照、錄像、視頻流傳輸ESP-IDF / PlatformIOESP32-Camera
DeepSleep深度睡眠低功耗ESP-IDF / PlatformIOESP32 系列
ESPNowESP-NOW 無線通信ESP-IDF / PlatformIOESP32 系列
FreeRTOS多線程與實時系統ESP-IDF / PlatformIOESP32 系列
GPIO數字 IO 控制和外部中斷ESP-IDF / PlatformIOESP32 系列
I2S數字音頻接口ESP-IDF / PlatformIOESP32 系列
RMT紅外、433MHz 等遠程控制ESP-IDF / PlatformIOESP32 系列
Serial串口通信ESP-IDF / PlatformIOESP32 系列
Timer硬件定時器ESP-IDF / PlatformIOESP32 系列
Touch電容式觸摸感應ESP-IDF / PlatformIOESP32 系列
TWAICAN 總線通信ESP-IDF / PlatformIOESP32 系列

USB 功能示例

示例名稱功能描述開發工具適用晶片
CompositeDeviceUSB 複合設備ESP-IDF / PlatformIOESP32-S2、ESP32-S3
ConsumerControlUSB 消費類控制設備ESP-IDF / PlatformIOESP32-S2、ESP32-S3
CustomHIDDevice自定義 USB HID 設備ESP-IDF / PlatformIOESP32-S2、ESP32-S3
FirmwareMSCU 盤/USB MSC 設備ESP-IDF / PlatformIOESP32-S2、ESP32-S3
GamepadUSB 遊戲手柄ESP-IDF / PlatformIOESP32-S2、ESP32-S3
KeyboardUSB 鍵盤ESP-IDF / PlatformIOESP32-S2、ESP32-S3
KeyboardAndMouseControlUSB 鍵盤+滑鼠組合ESP-IDF / PlatformIOESP32-S2、ESP32-S3
Mouse/ButtonMouseControlUSB 滑鼠ESP-IDF / PlatformIOESP32-S2、ESP32-S3
SystemControlUSB 系統控制設備ESP-IDF / PlatformIOESP32-S2、ESP32-S3
USBMSCU 盤/USB MSC 設備ESP-IDF / PlatformIOESP32-S2、ESP32-S3
USBSerial虛擬 USB 串口ESP-IDF / PlatformIOESP32-S2、ESP32-S3
USBVendor自定義 USB 通信協議ESP-IDF / PlatformIOESP32-S2、ESP32-S3

ESP32 系列芯片功能對比

下表列出了 ESP32 系列芯片在不同開發框架下的功能支持情況。請注意,某些功能可能在 Arduino 框架和 ESP-IDF 框架下有不同的支持狀態。

外設/功能ESP32ESP32-S2ESP32-C3ESP32-S3ESP32-C6ESP32-H2
ADC支持支持支持支持支持支持
BT Classic支持不支持不支持支持支持不支持
BLE支持支持支持支持支持支持
DAC支持支持不支持支持不支持不支持
EthernetArduino 支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 不支持Arduino 不支持, ESP-IDF 不支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持
GPIO支持支持支持支持支持支持
Hall SensorArduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持不支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持不支持
I2C支持支持支持支持支持支持
I2S支持支持支持支持支持支持
LEDC支持支持支持支持支持支持
Motor PWMArduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持
Pulse CounterArduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持
RMT支持支持支持支持支持支持
SDIOArduino 支持, ESP-IDF 不支持Arduino 支持, ESP-IDF 不支持不支持Arduino 支持, ESP-IDF 不支持不支持Arduino 不支持, ESP-IDF 支持
SDMMC支持不支持不支持支持不支持不支持
Timer支持支持支持支持支持支持
Temp. SensorArduino 不支持, ESP-IDF 支持支持支持支持支持支持
Touch支持支持不支持支持不支持不支持
TWAIArduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持Arduino 不支持, ESP-IDF 支持
UART支持支持支持支持支持支持
USB支持支持支持支持支持Arduino 不支持, ESP-IDF 支持
Wi-Fi支持支持支持支持支持不支持
IEEE 802.15.4不支持不支持支持不支持支持支持
Zigbee 協議棧不支持不支持支持不支持支持支持
Thread 協議不支持不支持Arduino 不支持, ESP-IDF 支持不支持支持支持
經典藍牙支持不支持不支持支持支持不支持
藍牙 LE支持支持支持支持支持支持
ESP-NOW支持支持支持支持支持不支持
Matter 協議不支持不支持Arduino 不支持, ESP-IDF 支持不支持支持支持

注意:此表格中的信息可能會隨時間變化,請以最新的官方文檔為準。