基于 Arduino 测试 ESP32 WiFi Station 连接路由器最简代码

  • 使能 WiFi Station 模式
  • 打印 got ip 信息
#include 
#include 
 
const char* ssid = "cc";
const char* password = "12345678";
 
 
void setup() {
  Serial.begin(115200);
  delay(1000);
  
  // 连接到WiFi网络
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  
 
  Serial.println("WiFi connected");
  Serial.println("IP address: " + WiFi.localIP().toString());
}
 
void loop() {
 

}

你可能感兴趣的:(智能路由器)