Home / References / ESP32 Library / WiFi API / AP
Description
The softAPSSID
method is used to get the SSID (network name) of the Wi-Fi Access Point (AP) created by the ESP32. This method is part of the ESP32 WiFi Library and is useful for retrieving the SSID of the AP in softAP mode.
Syntax and Usage
The softAPSSID
method can be used to retrieve the SSID of the softAP. It does not require any arguments.
String ssid = WiFi.softAPSSID();
This usage retrieves the SSID of the current softAP configuration.
Argument(s)
This method does not require any arguments.
Return Value
The softAPSSID
method returns the SSID of the softAP as a String
.
Example Codes
This example demonstrates how to use the ESP32’s softAPSSID()
method to retrieve the SSID (network name) of the device when operating in SoftAP (Access Point) mode. The method returns the currently configured SSID, which is useful for verification and debugging purposes.
To use this code, upload it to your ESP32 board. It will create an access point named “AvantMaker-ESP32-AP” with password “12345678”, then retrieve and print the SSID to the Serial Monitor at 115200 baud. This confirms the AP is broadcasting with the correct network name
/*
* Author: Avant Maker
* Date: February 13, 2025
* Version: 1.0
* Description: This example code shows how to use
* WiFi.softAPSSID() to get the SSID of ESP32 softAP.
*
* License: MIT
*
* Code Source: This example code is sourced from the Comprehensive
* Guide to the ESP32 Arduino Core Library, accessible on
* AvantMaker.com. For additional code examples and in-depth
* documentation related to the ESP32 Arduino Core Library,
* please visit:
*
* https://avantmaker.com/references/esp32-arduino-core-index/
*
* AvantMaker.com, your premier destination for all things
* DIY, AI, IoT, Smart Home, and STEM projects. We are dedicated
* to empowering makers,learners, and enthusiasts with the resources
* they need to bring their innovative ideas to life.
*/
#include <WiFi.h>
void setup() {
Serial.begin(115200);
// Start the softAP with a predefined SSID and password
WiFi.softAP("AvantMaker-ESP32-AP", "12345678");
// Get the SSID of the SoftAP
String ssid = WiFi.softAPSSID();
// wait a bit
delay(1000);
// Display the SSID of the SoftAP
Serial.print("SoftAP SSID: ");
Serial.println(ssid);
}
void loop() {
// Do nothing
}
AvantMaker Tutorial Suggestion
If you want to learn more about the ESP32’s WiFi capabilities, we’ve created a beginner-friendly guide that explains them in detail. Just click the link below, and you’ll be teleported to that page. It will clear up any confusion you may have while connecting your ESP32 to WiFi or setting it up as a WiFi access point (AP).
ESP32 Library Index
- ESP32 WiFiClient Library
- ESP32 HTTPClient Library
- ESP32 WiFiClientSecure Library
- ESP32 WebServer Library
- ESP32 WiFi Library
- Which ESP32 Boards are Recommended for Learners
- How to Copy Codes from AvantMaker.com
- What is SPIFFS and how to upload files to it?
- What is LIttleFS and how to upload files to it?
Ready to experiment and explore more about ESP32? Visit our website’s All About ESP32 Resources Hub, packed with tutorials, guides, and tools to inspire your maker journey. Experiment, explore, and elevate your skills with everything you need to master this powerful microcontroller platform!