### Configuration AP Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating how to configure and start a persistent Access Point (AP). ```C++ #include void setup() { Serial.begin(115200); Serial.println("ConfigurationAP example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Configure the AP const char* apSSID = "MyAP"; const char* apPassphrase = "MyPassword"; WiFi.configureAP(apSSID, apPassphrase); // Start the AP without parameters to use persistent settings Serial.println("Starting AP..."); if (WiFi.beginAP() == WL_AP_CONNECTED) { Serial.println("AP started successfully"); printAPData(); } else { Serial.println("Failed to start AP"); } } void loop() { // Nothing to do here } void printAPData() { Serial.print("AP SSID: "); Serial.println(WiFi.apSSID()); Serial.print("AP Max Connections: "); Serial.println(WiFi.apMaxConnections()); Serial.print("AP DHCP is enabled: "); Serial.println(WiFi.apDhcpIsEnabled()); Serial.print("AP IP Address: "); Serial.println(WiFi.apIP()); Serial.print("AP Subnet Mask: "); Serial.println(WiFi.apSubnetMask()); } ``` -------------------------------- ### Setup Persistent AP Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating how to set up a persistent Access Point (AP) with specific configurations. ```C++ #include void setup() { Serial.begin(115200); Serial.println("SetupPersistentAP example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Configure the AP with specific parameters const char* apSSID = "PersistentAP"; const char* apPassphrase = "SecurePass"; WiFiEncryptionType encryptionType = WIFI_ENCRYPTION_WPA2_PSK; int maxConnections = 4; bool isHidden = false; bool dhcpEnabled = true; WiFi.configureAP(apSSID, apPassphrase, encryptionType, maxConnections, isHidden, dhcpEnabled); // Start the AP Serial.println("Starting AP..."); if (WiFi.beginAP() == WL_AP_CONNECTED) { Serial.println("AP started successfully"); printAPData(); } else { Serial.println("Failed to start AP"); } } void loop() { // Nothing to do here } void printAPData() { Serial.print("AP SSID: "); Serial.println(WiFi.apSSID()); Serial.print("AP Encryption Type: "); Serial.println(WiFi.apEncryptionType()); Serial.print("AP Max Connections: "); Serial.println(WiFi.apMaxConnections()); Serial.print("AP is Hidden: "); Serial.println(WiFi.apIsHidden()); Serial.print("AP DHCP is enabled: "); Serial.println(WiFi.apDhcpIsEnabled()); Serial.print("AP IP Address: "); Serial.println(WiFi.apIP()); Serial.print("AP Gateway IP: "); Serial.println(WiFi.apGatewayIP()); Serial.print("AP Subnet Mask: "); Serial.println(WiFi.apSubnetMask()); } ``` -------------------------------- ### Setup Persistent WiFi Connection Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating how to set the WiFi connection to be remembered for automatic reconnection. ```C++ #include void setup() { Serial.begin(115200); Serial.println("SetupPersistentWiFiConnection example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Set to remember the WiFi connection WiFi.setPersistent(true); // Try to connect to the last remembered WiFi AP Serial.println("Connecting to last remembered WiFi AP..."); if (WiFi.begin() == WL_CONNECTED) { Serial.println("Connected to remembered WiFi AP"); printWiFiData(); } else { Serial.println("Failed to connect to remembered WiFi AP"); } } void loop() { // Nothing to do here } ``` -------------------------------- ### Pager Server Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating how to use NetApiHelpers for a WiFiServer with available() functionality. ```C++ #include #include // Assuming this library is available // Define your WiFi credentials const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; // Use NetApiHelpers to create a server with available() functionality NetApiServer server(1234); // Use a specific port void setup() { Serial.begin(115200); Serial.println("PagerServer example using NetApiHelpers"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Connect to WiFi if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); server.begin(); Serial.println("Server started on port 1234"); } else { Serial.println("Failed to connect to WiFi"); return; } } void loop() { // Accept new clients WiFiClient client = server.available(); if (client) { Serial.println("New client connected"); while (client.connected()) { if (client.available()) { char buffer[256]; int len = client.read((uint8_t*)buffer, sizeof(buffer) - 1); buffer[len] = '\0'; Serial.print("Received: "); Serial.println(buffer); // Send a response back client.print("Message received: "); client.println(buffer); } } Serial.println("Client disconnected"); } delay(10); } ``` -------------------------------- ### SNTP Time Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating how to enable and configure SNTP servers to get the current time. ```C++ #include void setup() { Serial.begin(115200); Serial.println("SNTPTime example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Connect to WiFi const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); // Configure and enable SNTP const char* ntpServer1 = "pool.ntp.org"; const char* ntpServer2 = "time.nist.gov"; WiFi.sntp(ntpServer1, ntpServer2); Serial.println("SNTP enabled and configured."); // You can now get the time using WiFi.getTime() or similar functions if available // Note: WiFiEspAT library might not directly expose time getters, check documentation } else { Serial.println("Failed to connect to WiFi"); } } void loop() { // Nothing to do here } ``` -------------------------------- ### SD Card Web Server Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating efficient sending of SD card file content using the WiFiClient write function. ```C++ #include #include // Define your WiFi credentials const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; WiFiServer server(80); void setup() { Serial.begin(115200); Serial.println("SDWebServer example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Connect to WiFi if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); server.begin(); Serial.println("Server started"); } else { Serial.println("Failed to connect to WiFi"); return; } // Initialize SD card if (!SD.begin(4)) { // Use the correct CS pin for your SD card module Serial.println("SD card initialization failed!"); return; } Serial.println("SD card initialized."); } void loop() { WiFiClient client = server.available(); if (client) { Serial.println("New client connected"); while (client.connected()) { if (client.available()) { char req[256]; client.read((uint8_t*)req, 255); req[255] = '\0'; Serial.println(req); // Simple HTTP response - serve a file from SD card client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); client.println(); File webFile = SD.open("index.html"); // Replace with your HTML file if (webFile) { // Use WiFiClient write(File) for efficient sending client.write(webFile); webFile.close(); } else { client.println("File not found"); } break; // Close connection after sending response } } delay(1); client.stop(); Serial.println("Client disconnected"); } } ``` -------------------------------- ### Advanced Chat Server Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating how to implement an advanced chat server using WiFiServer accept. ```C++ #include // Define your WiFi credentials const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; WiFiServer server(1234); // Use a specific port for the chat server void setup() { Serial.begin(115200); Serial.println("AdvancedChatServer example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Connect to WiFi if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); server.begin(); Serial.println("Chat server started on port 1234"); } else { Serial.println("Failed to connect to WiFi"); return; } } void loop() { // Accept new clients WiFiClient client = server.accept(); if (client) { Serial.println("New client connected"); while (client.connected()) { if (client.available()) { char buffer[256]; int len = client.read((uint8_t*)buffer, sizeof(buffer) - 1); buffer[len] = '\0'; Serial.print("Received: "); Serial.println(buffer); // Echo message back to the client client.print("Echo: "); client.println(buffer); } } Serial.println("Client disconnected"); } delay(10); } ``` -------------------------------- ### UDP Sender Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating sending an UDP message without requiring udp.begin() beforehand. ```C++ #include // Define your WiFi credentials const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; // Remote host and port for UDP communication const char* remoteHost = "192.168.1.100"; // Replace with your target IP const uint16_t remotePort = 12345; // Replace with your target port void setup() { Serial.begin(115200); Serial.println("UdpSender example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Connect to WiFi if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); // Send an UDP message Serial.print("Sending UDP packet to "); Serial.print(remoteHost); Serial.print(":"); Serial.println(remotePort); // No need to call udp.begin() before udp.beginPacket() if (WiFi.beginPacket(remoteHost, remotePort)) { WiFi.write((uint8_t*)"Hello UDP!", 10); if (WiFi.endPacket()) { Serial.println("UDP packet sent successfully"); } else { Serial.println("Error sending UDP packet"); } } else { Serial.println("Error starting UDP packet transmission"); } } else { Serial.println("Failed to connect to WiFi"); } } void loop() { // Nothing to do here } ``` -------------------------------- ### Print Persistent Settings Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example to print the hostname, SSID, and DHCP status of the WiFi connection. ```C++ #include void setup() { Serial.begin(115200); Serial.println("PrintPersistentSettings example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Connect to a WiFi network (replace with your SSID and password) const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; Serial.print("Connecting to "); Serial.println(ssid); if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); printWiFiData(); } else { Serial.println("Failed to connect to WiFi"); } } void loop() { // Nothing to do here } void printWiFiData() { // Print hostname char hostname[64]; if (WiFi.hostname(hostname)) { Serial.print("Hostname: "); Serial.println(hostname); } // Print SSID char ssid[33]; if (WiFi.SSID(ssid)) { Serial.print("SSID: "); Serial.println(ssid); } // Check if DHCP is enabled Serial.print("DHCP is enabled: "); Serial.println(WiFi.dhcpIsEnabled()); } ``` -------------------------------- ### Start SoftAP with Default Settings Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Starts the ESP's SoftAP (Access Point) with default or previously remembered persistent settings. This is useful for creating a local network without external WiFi. ```cpp WiFi.beginAP(); ``` -------------------------------- ### WiFiEspAT2 UDP Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating AT2 specific UDP functions like availableForParse and parsePacket. ```C++ #include // Define your WiFi credentials const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; void setup() { Serial.begin(115200); Serial.println("WiFiEspAT2UDP example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Connect to WiFi if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); // Example: Listen for UDP packets on a specific port uint16_t listenPort = 12345; Serial.print("Listening for UDP packets on port "); Serial.println(listenPort); // Note: In a real scenario, you would likely have a sender sending packets to this ESP. // This example focuses on demonstrating the AT2 UDP functions. // You can periodically check for incoming packets: // unsigned long startTime = millis(); // while (millis() - startTime < 5000) { // Check for 5 seconds // int packetSize = WiFi.availableForParse(); // if (packetSize > 0) { // Serial.print("Received UDP packet of size: "); // Serial.println(packetSize); // uint8_t buffer[packetSize]; // IPAddress senderIP; // uint16_t senderPort; // if (WiFi.parsePacket(buffer, packetSize, senderIP, senderPort)) { // Serial.print("From: "); // Serial.print(senderIP); // Serial.print(":"); // Serial.println(senderPort); // Serial.print("Data: "); // for (int i = 0; i < packetSize; i++) { // Serial.write(buffer[i]); // } // Serial.println(); // } else { // Serial.println("Failed to parse packet"); // } // } // delay(10); // } } else { Serial.println("Failed to connect to WiFi"); } } void loop() { // Example of checking for UDP packets in the loop int packetSize = WiFi.availableForParse(); if (packetSize > 0) { Serial.print("Received UDP packet of size: "); Serial.println(packetSize); uint8_t buffer[packetSize]; IPAddress senderIP; uint16_t senderPort; if (WiFi.parsePacket(buffer, packetSize, senderIP, senderPort)) { Serial.print("From: "); Serial.print(senderIP); Serial.print(":"); Serial.println(senderPort); Serial.print("Data: "); for (int i = 0; i < packetSize; i++) { Serial.write(buffer[i]); } Serial.println(); } else { Serial.println("Failed to parse packet"); } } delay(10); } ``` -------------------------------- ### Deep Sleep and Hardware Reset Example Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating how to put the ESP into deep sleep mode and perform a hardware reset. ```C++ #include void setup() { Serial.begin(115200); Serial.println("DeepSleepAndHwReset example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Example: Connect to WiFi before sleeping (optional) const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); } else { Serial.println("Failed to connect to WiFi"); } Serial.println("Entering deep sleep for 10 seconds..."); // Deep sleep for a specified duration (in seconds) WiFi.deepSleep(10000); // After waking up from deep sleep, the ESP will reset. // The following line will likely not be reached unless deepSleep is called differently. Serial.println("Woke up from deep sleep."); // Example of hardware reset (use with caution) // WiFi.reset(); // This will reset the ESP immediately } void loop() { // The loop will not be reached if deepSleep is called and the device resets. } ``` -------------------------------- ### Efficient Sending with Callback Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Example demonstrating efficient data sending using a callback function with WiFiClient. ```C++ #include // Callback function to generate data on the fly size_t generateData(uint8_t* buffer, size_t size) { static int counter = 0; char data[50]; size_t len = snprintf((char*)data, sizeof(data), "Data packet %d\n", counter++); if (len > size) { len = size; // Truncate if data is too large for buffer } memcpy(buffer, data, len); return len; } void setup() { Serial.begin(115200); Serial.println("Efficient sending with callback example"); // Initialize WiFi if (WiFi.init("AT", "esp32-uart", 115200, -1, -1)) { Serial.println("WiFi init success"); } else { Serial.println("WiFi init failed"); return; } // Connect to WiFi const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; if (WiFi.begin(ssid, password) == WL_CONNECTED) { Serial.println("Connected to WiFi"); // Create a WiFiClient and connect to a server WiFiClient client; const char* host = "example.com"; uint16_t port = 80; Serial.print("Connecting to "); Serial.print(host); Serial.print(":"); Serial.println(port); if (client.connect(host, port)) { Serial.println("Connected to server"); // Send data using the write(callback) variant Serial.println("Sending data via callback..."); client.write(generateData); Serial.println("Data sent."); client.stop(); Serial.println("Connection closed."); } else { Serial.println("Connection to server failed"); } } else { Serial.println("Failed to connect to WiFi"); } } void loop() { // Nothing to do here } ``` -------------------------------- ### Flash AT 1.7 Firmware (2MB-c1) Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Use this command to flash AT firmware version 1.7.x for esp8266 with a 2MB-c1 flash partition. Ensure you have esptool.py installed. ```bash esptool.py write_flash --flash_size 2MB-c1 0x0 boot_v1.7.bin 0x01000 at/1024+1024/user1.2048.new.5.bin 0x1fb000 blank.bin 0x1fc000 esp_init_data_default_v08.bin 0xfe000 blank.bin 0x1fe000 blank.bin ``` -------------------------------- ### Start Persistent WiFi Connection Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Initiates a persistent WiFi connection using previously saved network credentials. The ESP will attempt to connect automatically on startup. ```cpp WiFi.begin(); ``` -------------------------------- ### Define Custom TCP Buffer Sizes for Mega Board Source: https://github.com/jandrassy/wifiespat/blob/master/README.md This example shows how to define custom TCP buffer sizes for the Arduino Mega board using build extra flags in a boards.local.txt file. ```text mega.build.extra_flags=-DWIFIESPAT_TCP_RX_BUFFER_SIZE=128 -DWIFIESPAT_TCP_TX_BUFFER_SIZE=128 ``` -------------------------------- ### Flash AT 1.7 Firmware (1MB) Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Use this command to flash AT firmware version 1.7.4 for esp8266 with a 1MB flash partition. Ensure you have esptool.py installed. ```bash esptool.py write_flash --flash_size 1MB 0x0 boot_v1.7.bin 0x01000 at/512+512/user1.1024.new.2.bin 0xfb000 blank.bin 0xfc000 esp_init_data_default_v08.bin 0xfe000 blank.bin 0x7e000 blank.bin ``` -------------------------------- ### Setup Persistent WiFi Connection Source: https://github.com/jandrassy/wifiespat/blob/master/README.md This sketch establishes a persistent connection to a WiFi network. Set your SSID and password in the arduino_secrets tab. It demonstrates how to connect and maintain a network link. ```c++ #include #include "arduino_secrets.h" char ssid[] = SECRET_SSID; char pass[] = SECRET_PASS; void setup() { Serial.begin(115200); Serial1.begin(115200); // Initialize WiFi connection WiFi.init(Serial1); Serial.println("Connecting to WiFi..."); int status = WiFi.begin(ssid, pass); if (status == WL_CONNECTED) { Serial.println("Connected to WiFi network."); Serial.print("SSID: "); Serial.println(WiFi.SSID()); Serial.print("IP address: "); Serial.println(WiFi.localIP()); } else { Serial.println("Failed to connect to WiFi network."); Serial.print("Status code: "); Serial.println(status); } } void loop() { // The connection is persistent, so loop can be empty or used for other tasks } ``` -------------------------------- ### Disable Persistent SoftAP at Startup Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Disables the ESP from automatically starting the SoftAP with persistent settings upon startup. The persistent AP settings themselves are not cleared by this command. ```cpp WiFi.endAP(true); ``` -------------------------------- ### Initialize Hardware Serial for WiFiEspAT Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Initializes the WiFiEspAT library using hardware Serial1 for communication with the AT firmware. This is the recommended approach for boards with available hardware serial ports. ```cpp WiFi.init(Serial1); ``` -------------------------------- ### Check AT Firmware Version Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Run this sketch to verify communication with the WiFi module and check its AT firmware version. If it fails, double-check your wiring. ```c++ #include void setup() { Serial.begin(115200); Serial1.begin(115200); // Assuming Serial1 is used for ESP communication Serial.println("Checking firmware..."); // Check firmware version if (WiFi.checkFirmwareVersion(Serial1)) { Serial.println("Firmware check successful."); Serial.print("Firmware version: "); Serial.println(WiFi.firmwareVersion()); } else { Serial.println("Communication with WiFi module failed!"); Serial.println("Check wiring and AT firmware."); } } void loop() { // Nothing to do in loop for this example } ``` -------------------------------- ### Configure WiFiEspAT for AT Firmware Version 2.4.0+ Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Comment out the WIFIESPAT1 define in EspAtDrvTypes.h for AT firmware versions 2.4.0 and higher. This ensures compatibility with newer firmware. ```c++ //#define WIFIESPAT1 ``` -------------------------------- ### Initialize Hardware Reset for WiFiEspAT Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Initializes the WiFiEspAT library using a specified Arduino pin for hardware reset of the ESP module. The pin is set as the second parameter in the WiFi.init function. ```cpp WiFi.init(Serial1, ESP_RESET_PIN); ``` -------------------------------- ### Change AT Firmware Baud Rate with SoftwareSerial Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Use this sketch to set the baud rate for communication with the AT firmware when using SoftwareSerial. Ensure correct wiring if the sketch reports communication failure. ```c++ #include #include // Define pins for SoftwareSerial #define RX_PIN 6 #define TX_PIN 7 SoftwareSerial SerialAT(RX_PIN, TX_PIN); void setup() { Serial.begin(115200); SerialAT.begin(460800); // Set a high baud rate for AT communication Serial.println("Attempting to communicate with WiFi module..."); // Try to change baud rate if (WiFi.changeATBaudRate(SerialAT)) { Serial.println("Baud rate changed successfully."); // You might want to re-initialize SerialAT with the new baud rate if needed // SerialAT.begin(NEW_BAUD_RATE); } else { Serial.println("Failed to change baud rate."); } Serial.println("Setup complete."); } void loop() { // Nothing to do in loop for this example } ``` -------------------------------- ### Configure AT Firmware UART for Flow Control Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Use the AT+UART command with the last parameter set to 2 or 3 to activate flow control on the AT firmware side. ```at command AT+UART=,,, ``` -------------------------------- ### Enable UART Flow Control Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Uncomment this define in EspAtDrv.cpp or define it in boards.local.txt to enable flow control and disable connection state polling. ```c++ #define ESPATDRV_ASSUME_FLOW_CONTROL ``` -------------------------------- ### Flashing AT2 Firmware Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Command to flash AT firmware version 2.4 or higher using esptool.py. It is recommended to adjust flash mode to 'qio' and flash frequency to 40MHz if supported by the ESP module. ```bash esptool.py write_flash @download.config ``` -------------------------------- ### Disable AutoConnect with Persistent Settings Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Disables the automatic use of remembered network settings for connection on ESP startup, while keeping the settings stored. This prevents potential conflicts if WiFi.begin() is called manually. ```cpp WiFi.setAutoConnect(false); ``` -------------------------------- ### Set Persistent WiFi Connection Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Enables the ESP module to remember WiFi network settings for automatic connection after power-up or reset. This reduces sketch size and allows for asynchronous network connection. ```cpp WiFi.setPersistent(true); ``` -------------------------------- ### Disconnect and Clear Persistent WiFi Connection Source: https://github.com/jandrassy/wifiespat/blob/master/README.md Disconnects from the current WiFi network and clears the remembered persistent connection settings, disabling automatic connection on startup. Avoid using with WiFi.begin(ssid, pass) in the same sketch to prevent flash wear. ```cpp WiFi.disconnect(true); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.