EasyManua.ls Logo

Freenove ESP32-S3

Default Icon
142 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Any concerns? support@freenove.com
Chapter 5 WiFi Working Modes
74
www.freenove.com
Sketch_05.2_AP_mode
The following is the program code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <WiFi.h>
const char *ssid_AP = "WiFi_Name"; //Enter the router name
const char *password_AP = "12345678"; //Enter the router password
IPAddress local_IP(192,168,1,100);//Set the IP address of ESP32-S3 itself
IPAddress gateway(192,168,1,10); //Set the gateway of ESP32-S3 itself
IPAddress subnet(255,255,255,0); //Set the subnet mask for ESP32-S3 itself
void setup(){
Serial.begin(115200);
delay(2000);
Serial.println("Setting soft-AP configuration ... ");
WiFi.disconnect();
WiFi.mode(WIFI_AP);
Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");
Serial.println("Setting soft-AP ... ");
boolean result = WiFi.softAP(ssid_AP, password_AP);
if(result){
Serial.println("Ready");
Serial.println(String("Soft-AP IP address = ") + WiFi.softAPIP().toString());
Serial.println(String("MAC address = ") + WiFi.softAPmacAddress().c_str());
}else{
Serial.println("Failed!");
}
Serial.println("Setup End");
}
void loop() {
}
Include WiFi Library header file of ESP32-S3.
1
#include <WiFi.h>
Enter correct AP name and password.
3
4
const char *ssid_AP = "WiFi_Name"; //Enter the router name
const char *password_AP = "12345678"; //Enter the router password
Set ESP32-S3 in AP mode.
15
WiFi.mode(WIFI_AP);
Configure IP address, gateway and subnet mask for ESP32-S3.
16
WiFi.softAPConfig(local_IP, gateway, subnet)
Turn on an AP in ESP32-S3, whose name is set by ssid_AP and password is set by password_AP.
18
WiFi.softAP(ssid_AP, password_AP);