This example shows how to connect your ESP32 to an existing Wifi network using the Arduino Framework:
#include <Arduino.h> #include <WiFi.h> void setup() { Serial.begin(115200); WiFi.begin("MyWifiNetworkName", "MyWifiPassword"); while (WiFi.status() != WL_CONNECTED) { Serial.println("Wifi connecting..."); delay(500); } Serial.println("Wifi connected"); } void loop() { // put your main code here, to run repeatedly: }