-->
Page 1 of 1

SSID and Password through Serial failing to connect

PostPosted: Thu Jul 07, 2016 3:04 am
by rodmcm
If I use
char Ssid[ ] = "mySSID";
char Password[ ] = "mypassword";
and
WiFi.begin (Ssid,Password);

I get a reliable connection

If I assign set up variables char Ssid[20 ]; and char Password [20 ]; and populate them with the same Ssid and Password names via Serial.read(), then I cannot get a connection even though the remaining characters in the arrays are Null, as would be expected with the end of a string.

I have tried making sure both arrays have values in them before enabling WIFI.begin... No luck either

Any thoughts or has anyone done this. What I am doing is Using a Nextion for the user to enter their SSID and password and return to them the IP address as connected.

Re: SSID and Password through Serial failing to connect

PostPosted: Thu Jul 07, 2016 8:50 am
by martinayotte
I can't believe that both behaviours are not the same, simply because in WiFi.begin() both SSID and Password are copied using strcpy() into station_config structure.

It must be some stupid mistake in your code, such as you are not removing "\r\n" from Serial input.