Table of Contents

In Access Point mode (AP), the ESP32 acts as a Wi-Fi access point, creating its own Wi-Fi network that other devices can join. This mode works similarly to a wireless router, allowing multiple clients to connect to the ESP32.

ESP32 can host a simple web server in AP mode. Devices connecting to the ESP32 can access a web page, making this mode ideal for local control interfaces, configuration pages, or monitoring systems.

ESP32 AP mode can handle up to 4 simultaneous connections.

#include <WiFi.h>

// Set the SSID and password for the ESP32's Access Point
const char* ssid = "LonelyBinaryESP32AP";
const char* password = "123456789";  // Minimum 8 characters

void setup() {
  // Start serial communication
  Serial.begin(115200);
  Serial.println("Setting up Access Point...");

  // Set up the Access Point
  WiFi.softAP(ssid, password);

  // Print the IP address of the ESP32 in AP mode
  Serial.print("Access Point IP Address: ");
  Serial.println(WiFi.softAPIP());
}

void loop() {
  // Nothing to do here, the ESP32 is in AP mode
}
WiFi.softAP(ssid, password);

This function configures the ESP32 to operate in Access Point (AP) mode. By calling this function, the ESP32 will create a local Wi-Fi network with the specified SSID and password, and devices can connect to it directly.

WiFi.softAPIP()

WiFi.softAPIP() is a function that returns the IP address of the ESP32’s Access Point (AP) interface. By default, the ESP32 AP’s IP address is usually 192.168.4.1. The DHCP server is enabled by default, meaning that all connected wireless clients will have their IP addresses assigned automatically.

Categorized in:

WiFi,

Tagged in: