[GH-ISSUE #68] Not connecting to new WiFi without hard reset. #50

Closed
opened 2026-02-28 01:23:05 +03:00 by kerem · 35 comments
Owner

Originally created by @Kusnierz-Maciej on GitHub (Jan 17, 2016).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/68

After calling On Demand Configuration and configuring new wifi settings via configuration portal I get.

*WM: WiFi save
*WM: Sent wifi save page
*WM: Connecting to new AP
*WM: Connecting as wifi client...
*WM: Connection result:
*WM: 0
*WM: Failed to connect.
*WM: Request redirected to captive portal

WiFi settings are good, because after hard reset module connects to this wifi without any problems.

Originally created by @Kusnierz-Maciej on GitHub (Jan 17, 2016). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/68 After calling On Demand Configuration and configuring new wifi settings via configuration portal I get. *WM: WiFi save *WM: Sent wifi save page *WM: Connecting to new AP *WM: Connecting as wifi client... *WM: Connection result: *WM: 0 *WM: Failed to connect. *WM: Request redirected to captive portal WiFi settings are good, because after hard reset module connects to this wifi without any problems.
kerem closed this issue 2026-02-28 01:23:06 +03:00
Author
Owner

@tzapu commented on GitHub (Jan 17, 2016):

hi, could you update to latest github of esp8266 core for arduino?

<!-- gh-comment-id:172328908 --> @tzapu commented on GitHub (Jan 17, 2016): hi, could you update to latest github of esp8266 core for arduino?
Author
Owner

@odilonafonso commented on GitHub (Jan 18, 2016):

Dear tzu,
When you say to update to latest github of esp8266 core for Arduino, what exactly do you mean by that?
I have Arduino (and ESP8266) installed in three places:
/opt/arduino-1.6.5-r5
/home/odilon/.arduino15
/ home / odilon / Arduino (sketch folder and private libraries)
I do not know exactly where the esp8266 core Arduino must be installed
I am very confused by the amount of directories that both the Arduino as ESP8266 use, as well as the speed with which new updates are made.
Every time I do a new update, go through problems.
Could anyone tell me how best to work with Arduino and esp8266 on Ubuntu Linux 15.04?
I'm seriously considering uninstall ALL and start again.
Is a good idea ?
What release of Arduino should I use - the last? And the ESP8266 - 2.1.0-rc1?
I'm using Arduino 1.6.5 for being compatible with the Eclipse and Arduino plugin for eclipse.
But this is not the most important for me, if I need to update the Arduino IDE for the younger and abandon the use of eclipse.
My application is running 100% ok with the AT firmware when I put the application code (webserver and arduino functions) into the arduino hardware (ProMini, Arduino Uno, Nano, etc..) and I use the ESP8266 ONLY for wifi.
But now I want to use the ESP8266 WITHOUT Arduino... But this is proving to be impossible !!

<!-- gh-comment-id:172576821 --> @odilonafonso commented on GitHub (Jan 18, 2016): Dear tzu, When you say to update to latest github of esp8266 core for Arduino, what exactly do you mean by that? I have Arduino (and ESP8266) installed in three places: /opt/arduino-1.6.5-r5 /home/odilon/.arduino15 / home / odilon / Arduino (sketch folder and private libraries) I do not know exactly where the esp8266 core Arduino must be installed I am very confused by the amount of directories that both the Arduino as ESP8266 use, as well as the speed with which new updates are made. Every time I do a new update, go through problems. Could anyone tell me how best to work with Arduino and esp8266 on Ubuntu Linux 15.04? I'm seriously considering uninstall ALL and start again. Is a good idea ? What release of Arduino should I use - the last? And the ESP8266 - 2.1.0-rc1? I'm using Arduino 1.6.5 for being compatible with the Eclipse and Arduino plugin for eclipse. But this is not the most important for me, if I need to update the Arduino IDE for the younger and abandon the use of eclipse. My application is running 100% ok with the AT firmware when I put the application code (webserver and arduino functions) into the arduino hardware (ProMini, Arduino Uno, Nano, etc..) and I use the ESP8266 ONLY for wifi. But now I want to use the ESP8266 WITHOUT Arduino... But this is proving to be impossible !!
Author
Owner

@tzapu commented on GitHub (Jan 19, 2016):

Hi,

Easiest for you to try would be to get arduino 1.6.6, and install through boards manager 2.1.0 rc1 of the esp core and 0.6 of wifimanager

If you are feeling adventurous, and this should work with 1.6.5, Try this https://github.com/esp8266/Arduino/blob/master/README.md#using-git-version-

Make sure you removed the esp8266 older version you have, there should be a hardware/esp8266 com folder somewhere.

<!-- gh-comment-id:172746431 --> @tzapu commented on GitHub (Jan 19, 2016): Hi, Easiest for you to try would be to get arduino 1.6.6, and install through boards manager 2.1.0 rc1 of the esp core and 0.6 of wifimanager If you are feeling adventurous, and this should work with 1.6.5, Try this https://github.com/esp8266/Arduino/blob/master/README.md#using-git-version- Make sure you removed the esp8266 older version you have, there should be a hardware/esp8266 com folder somewhere.
Author
Owner

@odilonafonso commented on GitHub (Jan 19, 2016):

Ok... now I have Arduino IDE 1.6.7 and ESP8266WiFi git-version.
Things appear a little better, but not 100%.
Thanks for help. WiFiManager is a very nice tool !

<!-- gh-comment-id:172965522 --> @odilonafonso commented on GitHub (Jan 19, 2016): Ok... now I have Arduino IDE 1.6.7 and ESP8266WiFi git-version. Things appear a little better, but not 100%. Thanks for help. WiFiManager is a very nice tool !
Author
Owner

@tzapu commented on GitHub (Jan 20, 2016):

@Hooch180 could you try the change to the lib that @odilonafonso posted here https://github.com/tzapu/WiFiManager/issues/71#issuecomment-172958415

cheers

<!-- gh-comment-id:173106272 --> @tzapu commented on GitHub (Jan 20, 2016): @Hooch180 could you try the change to the lib that @odilonafonso posted here https://github.com/tzapu/WiFiManager/issues/71#issuecomment-172958415 cheers
Author
Owner

@madcrow commented on GitHub (Jan 21, 2016):

I am experiencing the exact same problem as @Hooch180 with both the following configurations:

  • Arduino 1.6.7 + Arduino core for ESP8266 v2.0.0 + WiFiManager 0.6
  • Arduino 1.6.7 + Arduino core for ESP8266 GitHub version 2016-01-21 + WiFiManager GitHub version 2016-01-21
<!-- gh-comment-id:173706953 --> @madcrow commented on GitHub (Jan 21, 2016): I am experiencing the exact same problem as @Hooch180 with both the following configurations: - Arduino 1.6.7 + Arduino core for ESP8266 v2.0.0 + WiFiManager 0.6 - Arduino 1.6.7 + Arduino core for ESP8266 GitHub version 2016-01-21 + WiFiManager GitHub version 2016-01-21
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

@madcrow could you try the change that @odilonafonso made, listed above and see if it s better?
cheers

<!-- gh-comment-id:173829918 --> @tzapu commented on GitHub (Jan 22, 2016): @madcrow could you try the change that @odilonafonso made, listed above and see if it s better? cheers
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

@tzapu I am afraid the solution offered by @odilonafonso won't be of any help in this scenario, because in this case the problem should be somewhere around the connectWifi() function call inside startConfigPortal() and NOT in autoConnect() .

Remember, this is the scenario, when:

  1. The ESP8266 tries to connect to an AP via autoConnect()
  2. The AP is unavailable or ESP8266 is not preconfigured for that particular AP -> the connectWifi() inside autoConnect returns something != WL_CONNECTED. (And this part of the library works perfectly well.)
  3. startConfigPortal() is called by autoConnect() -> the config portal is initialized, waiting for connections
  4. Teh user connects to config portal via browser, selects SSID, sets up credentials, and custom config data -> config portal signals connect=TRUE.
  5. The if (connect){} part of startConfigPortal() is being executed now, connection to the newly configured SSID is being attempted:
    if (connectWifi(_ssid, _pass) != WL_CONNECTED) //line 154 in WifiManager.cpp
    This is where the problem is: If the credentials were correctly configured, this connectWifi() call should return WL_CONNECTED. Instead it always returns 0, i.e WL_IDLE_STATUS.
<!-- gh-comment-id:173830978 --> @madcrow commented on GitHub (Jan 22, 2016): @tzapu I am afraid the solution offered by @odilonafonso won't be of any help in this scenario, because in this case the problem should be somewhere around the connectWifi() function call inside startConfigPortal() and NOT in autoConnect() . Remember, this is the scenario, when: 1) The ESP8266 tries to connect to an AP via autoConnect() 2) The AP is unavailable or ESP8266 is not preconfigured for that particular AP -> the connectWifi() inside autoConnect returns something != WL_CONNECTED. (And this part of the library works perfectly well.) 3) startConfigPortal() is called by autoConnect() -> the config portal is initialized, waiting for connections 4) Teh user connects to config portal via browser, selects SSID, sets up credentials, and custom config data -> config portal signals connect=TRUE. 5) The if (connect){} part of startConfigPortal() is being executed now, connection to the newly configured SSID is being attempted: if (connectWifi(_ssid, _pass) != WL_CONNECTED) //line 154 in WifiManager.cpp This is where the problem is: If the credentials were correctly configured, this connectWifi() call should return WL_CONNECTED. Instead it always returns 0, i.e WL_IDLE_STATUS.
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

you are correct of course...
and since you already tried 'Arduino 1.6.7 + Arduino core for ESP8266 v2.0.0 + WiFiManager 0.6' i m at a loss as to what to suggest... maybe try printing some messages to serial right before connecting to make sure _ssid & _pass did not get overwritten somehow? (poor memory management for instance..)

<!-- gh-comment-id:173831926 --> @tzapu commented on GitHub (Jan 22, 2016): you are correct of course... and since you already tried 'Arduino 1.6.7 + Arduino core for ESP8266 v2.0.0 + WiFiManager 0.6' i m at a loss as to what to suggest... maybe try printing some messages to serial right before connecting to make sure _ssid & _pass did not get overwritten somehow? (poor memory management for instance..)
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

I've just printed the SSID and pass:
...
DEBUG_WM(F("SSID: "));
DEBUG_WM(_ssid);
DEBUG_WM(F("Pass: "));
DEBUG_WM(_pass);
if (connectWifi(_ssid, _pass) != WL_CONNECTED) {
...

And they were both accurate.

<!-- gh-comment-id:173834805 --> @madcrow commented on GitHub (Jan 22, 2016): I've just printed the SSID and pass: ... DEBUG_WM(F("SSID: ")); DEBUG_WM(_ssid); DEBUG_WM(F("Pass: ")); DEBUG_WM(_pass); if (connectWifi(_ssid, _pass) != WL_CONNECTED) { ... And they were both accurate.
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

bollox...
if you just put WiFi.begin(ssid,pass) without wifi manager, does it work ok ?

<!-- gh-comment-id:173836340 --> @tzapu commented on GitHub (Jan 22, 2016): bollox... if you just put WiFi.begin(ssid,pass) without wifi manager, does it work ok ?
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

does it work after reset for you as well like for @Hooch180 ?

<!-- gh-comment-id:173836473 --> @tzapu commented on GitHub (Jan 22, 2016): does it work after reset for you as well like for @Hooch180 ?
Author
Owner

@Kusnierz-Maciej commented on GitHub (Jan 22, 2016):

@tzapu Now I swithed to WiFi.begin and manual conifg portal. I'm no longer using autoConnect. So yes. WiFi.begin works.

<!-- gh-comment-id:173836659 --> @Kusnierz-Maciej commented on GitHub (Jan 22, 2016): @tzapu Now I swithed to WiFi.begin and manual conifg portal. I'm no longer using autoConnect. So yes. WiFi.begin works.
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

so it must be that s happening when it goes from STA to AP and tries to connect.
@madcrow if you still ahve the test sketch
could you try to replace the begin in connectWifi with the following

WiFi.setAutoConnect(true); 
WiFi.begin(ssid.c_str(), pass.c_str(), 0, NULL, true);
<!-- gh-comment-id:173838382 --> @tzapu commented on GitHub (Jan 22, 2016): so it must be that s happening when it goes from STA to AP and tries to connect. @madcrow if you still ahve the test sketch could you try to replace the begin in connectWifi with the following ``` WiFi.setAutoConnect(true); WiFi.begin(ssid.c_str(), pass.c_str(), 0, NULL, true); ```
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

Yes, if I reset the module, it connects successfully, just like for @Hooch180.

<!-- gh-comment-id:173838396 --> @madcrow commented on GitHub (Jan 22, 2016): Yes, if I reset the module, it connects successfully, just like for @Hooch180.
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

Unfortunatly I don't have access to my sketch and HW right now, because now I am writing from my workplace.
But I will try your suggestion later.

<!-- gh-comment-id:173838857 --> @madcrow commented on GitHub (Jan 22, 2016): Unfortunatly I don't have access to my sketch and HW right now, because now I am writing from my workplace. But I will try your suggestion later.
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

ok,
there s another issue here that behaved similarly and a reboot was sorting it, so maybe i just have to add the feature to reset on end of configuration. wifi gets messed up a few times switching modes...

anyway, it would be really interesting to see the results of your test above, as i can t replicate the issue, i can t do it myself...

<!-- gh-comment-id:173839033 --> @tzapu commented on GitHub (Jan 22, 2016): ok, there s another issue here that behaved similarly and a reboot was sorting it, so maybe i just have to add the feature to reset on end of configuration. wifi gets messed up a few times switching modes... anyway, it would be really interesting to see the results of your test above, as i can t replicate the issue, i can t do it myself...
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

Of course.
I'll try it after work, I promise ;)

<!-- gh-comment-id:173839458 --> @madcrow commented on GitHub (Jan 22, 2016): Of course. I'll try it after work, I promise ;)
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

Hmm... it is interesting that you cannot replicate the issue. I have a NodeMCU 1.0 board (ESP12E) and a bare ESP12F module. I tried autoconnect on both, and both behaved the same (i.e. reboot was necessary to successfully connect).

<!-- gh-comment-id:173839960 --> @madcrow commented on GitHub (Jan 22, 2016): Hmm... it is interesting that you cannot replicate the issue. I have a NodeMCU 1.0 board (ESP12E) and a bare ESP12F module. I tried autoconnect on both, and both behaved the same (i.e. reboot was necessary to successfully connect).
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

i tried it on a wemos d1 mini and i ll try now on a nodemcu 1.0

<!-- gh-comment-id:173840284 --> @tzapu commented on GitHub (Jan 22, 2016): i tried it on a wemos d1 mini and i ll try now on a nodemcu 1.0
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

i did try it, it did connect for me. i did notice another bug and commited a fix (you never know)
here s what i did
open example AutoConnectWithFeedback, uploaded it, entered ssid/pass, saved, it connected
i did not add any portal password, or change anything else. maybe you can try this as well, maybe there is something different in your flow than mine...

what i would try:

  • run one of the examples directly see if it works as it should
  • try the snipped of code above, see if it helps
  • update to the latest github with the last fix, see if that helped...
<!-- gh-comment-id:173844532 --> @tzapu commented on GitHub (Jan 22, 2016): i did try it, it did connect for me. i did notice another bug and commited a fix (you never know) here s what i did open example AutoConnectWithFeedback, uploaded it, entered ssid/pass, saved, it connected i did not add any portal password, or change anything else. maybe you can try this as well, maybe there is something different in your flow than mine... what i would try: - run one of the examples directly see if it works as it should - try the snipped of code above, see if it helps - update to the latest github with the last fix, see if that helped...
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

Experiment 1

WiFi.begin(ssid.c_str(), pass.c_str());
line replaced by
WiFi.setAutoConnect(true);
WiFi.begin(ssid.c_str(), pass.c_str(), 0, NULL, true);
inside connectWifi().

Result:
*WM: Connecting as wifi client...
*WM: Connection result:
*WM: 0
*WM: Failed to connect

<!-- gh-comment-id:173910306 --> @madcrow commented on GitHub (Jan 22, 2016): Experiment 1 `WiFi.begin(ssid.c_str(), pass.c_str());` line replaced by `WiFi.setAutoConnect(true);` `WiFi.begin(ssid.c_str(), pass.c_str(), 0, NULL, true);` inside connectWifi(). Result: `*WM: Connecting as wifi client...` `*WM: Connection result:` `*WM: 0` `*WM: Failed to connect`
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

Experiment 2

Uploaded the AutoConnectWithTimeout example.

Result:
*WM: Connecting as wifi client...
*WM: Connection result:
*WM: 0
*WM: Failed to connect

<!-- gh-comment-id:173913437 --> @madcrow commented on GitHub (Jan 22, 2016): Experiment 2 Uploaded the AutoConnectWithTimeout example. Result: `*WM: Connecting as wifi client...` `*WM: Connection result:` `*WM: 0` `*WM: Failed to connect`
Author
Owner

@madcrow commented on GitHub (Jan 22, 2016):

Experiment 3

Updated to the latest GitHub code, and recompiled sketch.

Result:
The same :(

<!-- gh-comment-id:173913778 --> @madcrow commented on GitHub (Jan 22, 2016): Experiment 3 Updated to the latest GitHub code, and recompiled sketch. Result: The same :(
Author
Owner

@tzapu commented on GitHub (Jan 22, 2016):

oh man... disappointing..

i will try and add the option to reset rather than live connect so it at least works without you having to physically intervene

p.s. one other thing i do after uploading a firmware is that i reset the module before doing any tests. i have found that most of the times i can t do anything right with the esp when the firmware is loaded by the arduino ide without rebooting... grasping at straws here ... but worth a shot

<!-- gh-comment-id:173953850 --> @tzapu commented on GitHub (Jan 22, 2016): oh man... disappointing.. i will try and add the option to reset rather than live connect so it at least works without you having to physically intervene p.s. one other thing i do after uploading a firmware is that i reset the module before doing any tests. i have found that most of the times i can t do anything right with the esp when the firmware is loaded by the arduino ide without rebooting... grasping at straws here ... but worth a shot
Author
Owner

@bretskee commented on GitHub (Jan 25, 2016):

Hi,

I have a very similar issue in that all seems to connect OK until there is a connect fail due to a network issue or the like and the portal is started. After config and a remote reboot, the esp can no longer connect. I have been using wifi manager and had this issue and went back to implementing something very simple using

WiFi.disconnect();
WiFi.setAutoConnect(true);
WiFi.mode(WIFI_STA);
wiFi.begin(ssis, passwd);

if it fails, i start an AP using

WiFi.mode(WIFI_AP);
WiFi.softAP(Name);

I then start a telnet session to set some parameters and do a remote software reset.

I seem to be able to replicate the issue fairly consistently in testing. the procedure is as follows:

  1. hard boot and the unit connects reasonably reliably
  2. go to my router and take the network down
  3. let the esp fail on the network and start the AP and telnet session
  4. re-enable the wifi network
  5. remote reboot
  6. MOST of the time the esp will never again connect to the router. I say most because occasionally it will. Hardware reset fixes this most of the time and it connects.

i am using 1.6.5-r5 and the latest 2.1.0-rc2. i have been having this issue over a number of versions of both however.

wifi debug reports the following:

Mode: STA
PHY mode: N
Channel: 1
AP id: 0
Status: 0
Auto connect: 1
SSID (6): xxxxxx
Passphrase (10): xxxxxxxxxx
BSSID set: 0

I have also tried any combination of your suggestions above. There seems to be something fishy when changing modes. I could be wrong.

<!-- gh-comment-id:174386969 --> @bretskee commented on GitHub (Jan 25, 2016): Hi, I have a very similar issue in that all seems to connect OK until there is a connect fail due to a network issue or the like and the portal is started. After config and a remote reboot, the esp can no longer connect. I have been using wifi manager and had this issue and went back to implementing something very simple using WiFi.disconnect(); WiFi.setAutoConnect(true); WiFi.mode(WIFI_STA); wiFi.begin(ssis, passwd); if it fails, i start an AP using WiFi.mode(WIFI_AP); WiFi.softAP(Name); I then start a telnet session to set some parameters and do a remote software reset. I seem to be able to replicate the issue fairly consistently in testing. the procedure is as follows: 1. hard boot and the unit connects reasonably reliably 2. go to my router and take the network down 3. let the esp fail on the network and start the AP and telnet session 4. re-enable the wifi network 5. remote reboot 6. MOST of the time the esp will never again connect to the router. I say most because occasionally it will. Hardware reset fixes this most of the time and it connects. i am using 1.6.5-r5 and the latest 2.1.0-rc2. i have been having this issue over a number of versions of both however. wifi debug reports the following: Mode: STA PHY mode: N Channel: 1 AP id: 0 Status: 0 Auto connect: 1 SSID (6): xxxxxx Passphrase (10): xxxxxxxxxx BSSID set: 0 I have also tried any combination of your suggestions above. There seems to be something fishy when changing modes. I could be wrong.
Author
Owner

@tzapu commented on GitHub (Jan 25, 2016):

i ve always thought there was something fishy when changing mode. the first versions of WiFImanager would always reboot before connecting for that reason.
i am working on bringing that option back... for some modules, it seems the only way, at least for now

<!-- gh-comment-id:174414063 --> @tzapu commented on GitHub (Jan 25, 2016): i ve always thought there was something fishy when changing mode. the first versions of WiFImanager would always reboot before connecting for that reason. i am working on bringing that option back... for some modules, it seems the only way, at least for now
Author
Owner

@bretskee commented on GitHub (Jan 25, 2016):

dont know that will help since the issue persists through a software reset. there must be a subtlety between the hardware and software boot processes. do you think this is something that we will need help from Ivan Grokhotkov??

<!-- gh-comment-id:174417273 --> @bretskee commented on GitHub (Jan 25, 2016): dont know that will help since the issue persists through a software reset. there must be a subtlety between the hardware and software boot processes. do you think this is something that we will need help from Ivan Grokhotkov??
Author
Owner

@tzapu commented on GitHub (Jan 25, 2016):

a issue on the main esp8266 core branch with the minumum example (without wifimanager, just base wifi functions) that replicates this can t hurt.
the biggest issue is that if the problem is in the SDK, like a lot are, their hands are tied as well..

<!-- gh-comment-id:174417613 --> @tzapu commented on GitHub (Jan 25, 2016): a issue on the main esp8266 core branch with the minumum example (without wifimanager, just base wifi functions) that replicates this can t hurt. the biggest issue is that if the problem is in the SDK, like a lot are, their hands are tied as well..
Author
Owner

@tzapu commented on GitHub (Jan 25, 2016):

guys, i ve made some changes to the connection code as suggested here and added an example that soft resets if connection is not successful and tries again.
could you give it a try, see if it improves anything for you?

<!-- gh-comment-id:174425595 --> @tzapu commented on GitHub (Jan 25, 2016): guys, i ve made some changes to the connection code as suggested here and added an example that soft resets if connection is not successful and tries again. could you give it a try, see if it improves anything for you?
Author
Owner

@madcrow commented on GitHub (Jan 26, 2016):

Hey @tzapu, I gave it a try and it seems to work well.

<!-- gh-comment-id:175258641 --> @madcrow commented on GitHub (Jan 26, 2016): Hey @tzapu, I gave it a try and it seems to work well.
Author
Owner

@tzapu commented on GitHub (Jan 27, 2016):

nice, thanks for letting me know

<!-- gh-comment-id:175399406 --> @tzapu commented on GitHub (Jan 27, 2016): nice, thanks for letting me know
Author
Owner

@WheresWally commented on GitHub (May 5, 2016):

I had issues with the .c_str() function.

WiFi.begin(ssid.c_str(), pass.c_str());

I use this instead, and dont forget to trim leading/trailing spaces, they screw with it too

char ssss[32] = "";
char pppp[64] = "";
ssid.toCharArray(ssss, ssid.length() + 1);
password.toCharArray(pppp, password.length() + 1);
WiFi.begin(ssss , pppp);
<!-- gh-comment-id:217313558 --> @WheresWally commented on GitHub (May 5, 2016): I had issues with the .c_str() function. ``` WiFi.begin(ssid.c_str(), pass.c_str()); ``` I use this instead, and dont forget to trim leading/trailing spaces, they screw with it too ``` char ssss[32] = ""; char pppp[64] = ""; ssid.toCharArray(ssss, ssid.length() + 1); password.toCharArray(pppp, password.length() + 1); WiFi.begin(ssss , pppp); ```
Author
Owner

@MariaGemel commented on GitHub (May 5, 2017):

@bretskee
This one works:

WiFi.disconnect();
WiFi.setAutoConnect(true);
WiFi.mode(WIFI_STA);
wiFi.begin(ssis, passwd);

thank you so much!

<!-- gh-comment-id:299400170 --> @MariaGemel commented on GitHub (May 5, 2017): @bretskee This one works: WiFi.disconnect(); WiFi.setAutoConnect(true); WiFi.mode(WIFI_STA); wiFi.begin(ssis, passwd); thank you so much!
Author
Owner

@RottenVanSuti commented on GitHub (Apr 9, 2018):

Hi @MariaGemel Where do you place those functions? in the setup()?

<!-- gh-comment-id:379626199 --> @RottenVanSuti commented on GitHub (Apr 9, 2018): Hi @MariaGemel Where do you place those functions? in the setup()?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#50
No description provided.