Virtuino Forum
ESP32 as Acespoint - Printable Version

+- Virtuino Forum (https://virtuino.com/forum)
+-- Forum: Virtuino (https://virtuino.com/forum/forumdisplay.php?fid=1)
+--- Forum: Virtuino IoT (https://virtuino.com/forum/forumdisplay.php?fid=2)
+--- Thread: ESP32 as Acespoint (/showthread.php?tid=1162)



ESP32 as Acespoint - cvbtec - 12-27-2022

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.


RE: ESP32 as Acespoint - iliaslamprou - 12-28-2022

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!");
}



RE: ESP32 as Acespoint - cvbtec - 12-28-2022

(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?


RE: ESP32 as Acespoint - iliaslamprou - 12-28-2022

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