Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

WiFi.softAP(ssid, password) does not seem to work.. #1141

Closed
shirish47 opened this issue Dec 4, 2015 · 25 comments
Closed

WiFi.softAP(ssid, password) does not seem to work.. #1141

shirish47 opened this issue Dec 4, 2015 · 25 comments
Milestone

Comments

@shirish47
Copy link

#include <ESP8266WiFi.h>
#include <WiFiClient.h> 
#include <ESP8266WebServer.h>

/* Set these to your desired credentials. */
const char *ssid = "ESPap";
const char *password = "thereisnospoon";

ESP8266WebServer server(80);

void handleRoot() {
    server.send(200, "text/html", "<h1>You are connected</h1>");
}

void setup() {
    delay(1000);
    Serial.begin(4800);
    Serial.println();
    Serial.print("Configuring access point...");
    /* You can remove the password parameter if you want the AP to be open. */
    WiFi.softAP(ssid, password);

    IPAddress myIP = WiFi.softAPIP();
    Serial.print("AP IP address: ");
    Serial.println(myIP);
    server.on("/", handleRoot);
    server.begin();
    Serial.println("HTTP server started");
}
void loop() {
    server.handleClient();
}

I am using the staging version of ESP8266... the thing is that ESP is not showing the name as given ssid.. it shows AI-thinkers.. some thing like that and open network.

@igrr
Copy link
Member

igrr commented Dec 4, 2015

Duplicate of #1123?

@shirish47
Copy link
Author

seems like that.. but what is solutions..??

@shirish47
Copy link
Author

is it not fixable? a hardware issue??

@igrr
Copy link
Member

igrr commented Dec 4, 2015

As mentioned down that link, it is fixed in git and in stable version. Just not yet in staging.

@zenmanenergy
Copy link

It's working for me, but the first request is REALLY slow. It takes 30 seconds for the softap example to work the first time, then every request after that is fast.

@igrr igrr added this to the 2.1.0 milestone Dec 5, 2015
@shirish47
Copy link
Author

OK ya stable version works fine.

@gosewski
Copy link

It is pretty obvious but I think it is worth to be mentioned. When the password is too short (less than 8 characters) the WiFi.softAP(ssid, password) function desn't work. Of course there is no warning during compilation.

@Links2004
Copy link
Collaborator

warning during compilation is not possible,
but the function return false (but to most user dont check the return value),
and when debug is enabled a error will be shown on serial.

https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp#L98-L102

@gosewski
Copy link

Yes, you are absolutely right about the warning during the compilation and I fully agree that most users don't check the return value (probably because this return value isn't checked even in the example sketches). Therefore I wrote that it is worth to be mentioned.

@khalilst
Copy link

@gosewski , Your tip solved my problem. Thanks

@gosewski
Copy link

@khalilst ,You're welcome. I am glad to hear that.

@NateZimmer
Copy link

@gosewski , thanks... had a password of "test" and it wasn't working. Increased the length and it worked just fine. Perhaps update the example sketch with a comment on the password length?

@ym58
Copy link

ym58 commented Nov 23, 2016

Sorry to post again on the same issue, but I am also unable to have my ESP8266 actively change its AP SSID/PW.

Needless to say that I have updated the related .h libraries (via the Arduino Library Mgr, not from the Github cause there is no button in the Github to download a library .ZIP file !)
My ESP8266WiFi.h is vers 1.0.0
My ESP8266WebServer.h is also 1.0.0
My WiFiClient.h unfortunately does not show in the Arduino library manager (... ?!? ...)

The AP starts up and works quite right but its SSID and PW are never set the way I wan't them to be set !
They keep previous values (from when ? maybe days ago !) as if the new sketch's SSID/PW values could not overwrite old ones, no matter what ...

The code below is only an excerpt of AP-relevant sections of my sketch.

 `(......)
WiFiServer server(80);

void setup() 
{
  initHardware();
  setupWiFi();
  server.begin();
}

void loop() 
{
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
  // Read the first line of the request
  String req = client.readStringUntil('\r');
  Serial.println(req);
  client.flush();
  (......)
}

void setupWiFi()
{
  WiFi.mode(WIFI_AP);
  WiFi.softAP("MyNewSSID", "abcdef0123456");
}
  (......)`

Unfortunately, the ESP/AP keeps giving me an old SSID/PW set that is written in its memory (EEPROM ?) and does not take into account the "MYNewSSID"/"abcdef0123456" set !

What's wrong ?

@MatrixMike
Copy link

regarding comment about no button to download ZIP file - please look for
GREEN 'CLONE OR DOWNLOAD' button on RHS of screen and nearby you will
find 'Download ZIP' . On some old browsers or browsers that don't
support this feature is might not be there. I use Firefox and from about
V 45 it has worked well.

On 24/11/16 02:06, ym58 wrote:

Sorry to post again on the same issue, but I am also unable to have my
ESP8266 actively change its AP SSID/PW.

Needless to say that I have updated the related .h libraries (via the
Arduino interface, not from the Github cause there is no button in the
Github to download a library .ZIP file !)
My ESP8266WiFi.h is vers 1.0.0
My ESP8266WebServer.h is also 1.0.0
My WiFiClient.h does not show in the Arduino library manager (... !...)

The AP starts up and works quite right but its SSID and PW are never set
the way I wan't them to be set !
The code below is only an excerpt of AP-relevant sections

|(......) WiFiServer server(80); void setup() { initHardware(); setupWiFi(); server.begin(); } void loop() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Read the first line of the request String req = client.readStringUntil('\r'); Serial.println(req); client.flush(); (......) void setupWiFi() { WiFi.mode(WIFI_AP); WiFi.softAP("MyNewSSID", "abcdef0123456"); } (......) |

Unfortunately, the ESP/AP keeps giving me an old SSID/PW set that is
written in its memory (EEPROM ?) and does not take into account the
"MYNewSSID"/"abcdef0123456" set !

What's wrong ?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1141 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEVhOLCXpX2N4VEDz0VUKXz5mHA9ZHIjks5rBFaTgaJpZM4GuwAF.

@ym58
Copy link

ym58 commented Nov 23, 2016

Hello Mike,
Sorry, no such button ... (latest version of Chrome).

tmp23

@MatrixMike
Copy link

my 'gentle' comment is that you are using a browser that does not take
full advantage (or enough of) the github web smarts.
To prove this to yourself - download and run a late (recent) live ubuntu
or mint iso DVD image and test on your machine -
the button DOES exist - I had the problem until I realised I selected a
browser that works with it.
Q Which browser do you use ? and for fun which OS / IDE do you use to
develop on?

On 24/11/16 05:49, ym58 wrote:

Hello Mike,
Sorry, no such button ...
tmp23
https://cloud.githubusercontent.com/assets/23702284/20574644/dcbf41a0-b1b5-11e6-9fb7-cb157fa8d5c9.jpg


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1141 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEVhOIlHa69eY7BjNbEoR4ldfVAAn9Pnks5rBIqjgaJpZM4GuwAF.

@NateZimmer
Copy link

Heh... the issue is your not at the top level of the repo. You can't zip just 1 folder to my knowledge.
https://github.com/esp8266/Arduino <-- should appear at this link.

@ym58
Copy link

ym58 commented Nov 24, 2016

@NateZimmer
You're my man :-) !
The .ZIP can be found only at top level, my mistake ...

@danielicy
Copy link

I know this post is quite old now but I'm having the same issue. I did verify the password is longer than 8 characters. the only way I'm being able to connect to the AP is when setting the mode WIFI_AP_STA and connecting to a router as station. I don't wan't to be forced to do this. any suggestions? @igrr

@wbenish
Copy link

wbenish commented Nov 13, 2018

I had problems using the ESP8266 as an access point and solved the problem by including the statement:
WiFi.mode(WIFI_AP);
See #4963

@fonsmol
Copy link

fonsmol commented Dec 4, 2018

It is pretty obvious but I think it is worth to be mentioned. When the password is too short (less than 8 characters) the WiFi.softAP(ssid, password) function desn't work. Of course there is no warning during compilation.

This should be accepted as one of the solutions. Thnx!

@IDispose
Copy link

It appears the password has to start with a character. When I used 12345678 as password SSID is not available. Changed it to welcome123 and AP works as expected.

@DAVIDBETAN2000
Copy link

AT COMMANDS RETURNING

@gibo77
Copy link

gibo77 commented Jan 10, 2020

Can you point me to a link about how to make the SSID name unique? I am thinking of using
"AnyName_"+ the last three mac address. Example AnyName_3BT6RT. The last three mac address will make this name unique, in case if you have more than one out there.

@mohamedanwer006
Copy link

It appears the password has to start with a character. When I used 12345678 as password SSID is not available. Changed it to welcome123 and AP works as expected.

This fix the problem thank you❤

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

No branches or pull requests