Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Running in AP mode? #253

Open
smartcontracts opened this issue Oct 20, 2022 · 4 comments
Open

Running in AP mode? #253

smartcontracts opened this issue Oct 20, 2022 · 4 comments

Comments

@smartcontracts
Copy link

Heyo, I'm interested in running the webserver in AP mode instead of connecting to a wifi network. I'm planning to use my device on the go so I won't have a stable wifi to connect to. Happy to modify source if necessary to get this working!

@smartcontracts
Copy link
Author

Gonna try replacing these lines with WiFi.softAP and see what happens:

wifiManager.setConfigPortalBlocking(false);

@smartcontracts
Copy link
Author

Removing the WiFi manager and including WiFi.softAP did work. Now just having issues connecting on iOS and webserver seems to randomly stall after a while. Gonna debug and see where I get.

@fercervantesx
Copy link

DId you remove anything more for it to work in AP Mode? I replaced the line you shared above with WiFi.softAP('mySSID') - and I don't see an AP with the SSID I specified

@kevinl7778
Copy link

This is from an older version, the version I use

const bool apMode = true;

if (apMode) {
WiFi.mode(WIFI_AP);
// Do a little work to get a unique-ish name. Append the
// last two bytes of the MAC (HEX'd) to "Thing-":
uint8_t mac[WL_MAC_ADDR_LENGTH];
WiFi.softAPmacAddress(mac);
String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) +
String(mac[WL_MAC_ADDR_LENGTH - 1], HEX);
macID.toUpperCase();
String AP_NameString = "Elvira";
char AP_NameChar[AP_NameString.length() + 1];
memset(AP_NameChar, 0, AP_NameString.length() + 1);
for (int i = 0; i < AP_NameString.length(); i++)
AP_NameChar[i] = AP_NameString.charAt(i);
WiFi.softAP(AP_NameChar, WiFiAPPSK);
Serial.printf("Connect to Wi-Fi access point: %s\n", AP_NameChar);
Serial.println("and open http://192.168.4.1 in your browser");
}
else {
WiFi.mode(WIFI_STA);
Serial.printf("Connecting to %s\n", ssid);
if (String(WiFi.SSID()) != String(ssid)) {
WiFi.begin(ssid, password);
}
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants