hello,
i am trying to set my esp 32 as both access point and station mode. I can see the access point has been created and it is visible in my PC and as well as in phone. But i could not connect them at the same time and it is working 1 out of 20 times.
#include <WiFi.h> #include <WiFiAP.h> const char* ssid = "Soneil_Electronics"; const char* password = "Soneilwaga123"; const char* assid = "espAccessPoint"; const char* asecret = "hello"; void setup(){ Serial.begin(115200); WiFi.begin(ssid,password); WiFi.mode(WIFI_AP_STA); Serial.println("Creating Accesspoint"); WiFi.softAP(assid,asecret,7,0,5); Serial.print("IP address:\t"); Serial.println(WiFi.softAPIP()); Serial.print("connecting to..."); Serial.println(ssid); WiFi.begin(ssid,password); while(WiFi.status() != WL_CONNECTED){ delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } void loop(){ }
this is program am using for esp32.
my serial monitor looks like
.[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND .[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START .....[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START ......[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START .....[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND .[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START .....[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START ......[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START ......[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START .....[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START .ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1100 load:0x40078000,len:9232 load:0x40080400,len:6400 entry 0x400806a8 [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 13 - AP_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 14 - AP_STOP Creating Accesspoint [E][WiFiAP.cpp:109] softAP(): passphrase too short! IP address: 192.168.4.1 connecting to...[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 13 - AP_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 13 - AP_START .....[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START ......[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START .....[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND .[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START .....[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START ......[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED [W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START .....
Hello, to be honest I’m not sure what’s missing in you code… However, I would recommend to take a look at this Unit: https://rntlab.com/extra-access-point-ap-for-wi-fi-car-robot/
It shows how to create a web server that is used an Access Point with the ESP32.
With the method that I’ve used in that project, you don’t need to use the #include <WiFiAP.h> library that you’re using (I’ve never used that before).
hello,
thank you for your response. Could you please recommend something where i can set esp32 as both access point and station mode at the same time.
Unfortunately the ESP32 can only be set as an Access Point or as a Station at a time…