Introduction
本示例为 使用ESP32连接校园网-WPA2-Enterprise的代码。
由于学校主要是使用企业WIFI,需要SSID、ID、PW,常规ESP32连接网络的方法不可用,因此参考资料后整理,以便在学校或企业wifi下的ESP32使用,为各位在校大学生开发适合于学校场景的物联网项目提供小小帮助。
适用范围
Code
/*|----------------------------------------------------------|*/
/*|WORKING EXAMPLE FOR ESP32 WIFI ENTERPRISE CONNECTION |*/
/*|TESTED BOARDS: ESP32 |*/
/*|CORE: Jan. 2024 |*/
/*|----------------------------------------------------------|*/
#include <WiFi.h>
#include <HTTPClient.h>
#if __has_include("esp_eap_client.h")
#include "esp_eap_client.h"
#else
#include "esp_wpa2.h"
#endif
#include <Wire.h>
#define EAP_IDENTITY "203980342" //请输入学号 或类似的网络账号
#define EAP_PASSWORD "Wmimamima" //请输入密码
const char *ssid = "PKU-Scholar"; // 网络SSID号,比如CMCC-PKU
int counter = 0;
void setup() {
Serial.begin(115200);
delay(10);
Serial.