ESP32 - Micropython ESP-IDF 双线教程 WIFI
ESP32 - IDF WIFI
转换为ESP32-IDF的示例代码
以下是使用ESP-IDF(Espressif IoT Development Framework)编写的连接到Wi-Fi网络的示例代码。
main/main.c
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "nvs_flash.h"
#include "esp_log.h"
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASS "your_wifi_password"
static const char *TAG = "wifi_example";
static void event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
{
if (e