Hello,
I have a simple code, in which I use serial monitor to enter ssid and pass for wifi ant then I try to connect using these values. Reading is fine, it prints back what I enter, but the wifi just can not connect... Im using esp8266 nodemcu board, but Arduino IDE and Arduino language. See code bellow:
Can you check how many bytes were actually read into ssid and pass? Print the characters one by one in ASCII to see if you have not captured a CR since you read till LF (is your console set up to send CR/LF each time?)
When I set Serial monitor window to both NL & CR it does not work, if I set up only newline, it works.
Suppose you set the line ending to CR/NL, and send "1". What is actually sent, then, is "1". When you read everything up to the NL, the string contains "1". When you then compare that to "1", of course they do not match.
When you set the line ending to NL only, , and send "1". What is actually sent, then, is "1". When you read everything up to the NL, the string contains "1". When you then compare that to "1", of course they match.
6v6gt:
What about just hard coding the SSID and password in your sketch as a first step in problem solving.
If even that fails, the problem lies elsewhere.
I cant hard code it. That the point
With hard coded ssid/pass it work of course.
With newline setting in SM it works, Ill implement @J-M-L ideas to make it more "general".
Now I have problem with the C# application sending these data. But that's for another topic.
jevniky:
I cant hard code it. That the point
With hard coded ssid/pass it work of course.
With newline setting in SM it works, Ill implement @J-M-L ideas to make it more "general".
Now I have problem with the C# application sending these data. But that's for another topic.
Thx guys.
The suggestion of hard coding the credentials was intended only to isolate the problem, and if you had already got that far, it would have been ideal if you had mentioned it in the OP.
Incidentally, the normal way of getting WLAN credentials into an ESP8266 is through a web browser, with the ESP8266 temporarily in "Access Point" mode and running a web server. Something like this makes it quite painless ESP8266 WiFi configuration manager library for Arduino IDE
6v6gt:
Incidentally, the normal way of getting WLAN credentials into an ESP8266 is through a web browser, with the ESP8266 temporarily in "Access Point" mode and running a web server. Something like this makes it quite painless ESP8266 WiFi configuration manager library for Arduino IDE