Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ESP32 as Acespoint
#1
Is it possibble to use the esp32 as accespoint with the virtuino webserver. I want to use the esp32 as standalone without an external network.
Reply
#2
Yes of course, the only you have to do is to change the code in the function connectToWiFiNetwork.


Code:
//================================================================= connectToWiFiNetwork
void connectToWiFiNetwork(){
   Serial.print("Access Point");        // Default IP: 192.168.4.1
   WiFi.mode(WIFI_AP);                  // Config module as Access point only.
   boolean result = WiFi.softAP("Virtuino AP","my_password");   // set the Access point SSID and password
   if(result == true)  {
     Serial.println("Server Ready");
     Serial.println(WiFi.softAPIP());
   }
   else  Serial.println("Failed!");
}
Reply
#3
(12-28-2022, 01:01 AM)iliaslamprou Wrote: Yes of course, the only you have to do is to change the code in the function connectToWiFiNetwork.


Code:
//================================================================= connectToWiFiNetwork
void connectToWiFiNetwork(){
   Serial.print("Access Point");        // Default IP: 192.168.4.1
   WiFi.mode(WIFI_AP);                  // Config module as Access point only.
   boolean result = WiFi.softAP("Virtuino AP","my_password");   // set the Access point SSID and password
   if(result == true)  {
     Serial.println("Server Ready");
     Serial.println(WiFi.softAPIP());
   }
   else  Serial.println("Failed!");
}

Hi iliaslamprou

Thx
One thing, when I want add a second client the Virtuino stops on he client that was working, and the new one doesn't connect.
Is it possible to connect more than one client or is this a ESP32 issue?
Reply
#4
Hello, you have to replace the WiFi with WiFiMulti

For ESP8266 declare  the following lines on the top of the code


#include <ESP8266WiFiMulti.h>
ESP8266WiFiMulti WiFiMulti;


For ESP32 add the lines:

#include <WiFiMulti.h>
WiFiMulti WiFiMulti;

then replace the connection function with this

Code:
//===================================================== connectToWiFiNetwork
void connectToWiFiNetwork(){
    WiFiMulti.addAP("SSID", "passpasspass");
    while(WiFiMulti.run() != WL_CONNECTED) {
        delay(100);
    }
   Serial.println("\nWiFi connected");

}


You can see some examples on the WebSockets library
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)