I am new here and I have been trying to experiment with a core.
Running into this problem and could not find any answer on the web. I hope someone can help me.
I am trying to set WiFi network via a program.
All parameters SSID and KEY are stored in Strings called ssid and key
When compiling WiFi.setCredentials(ssid, key, WPA); per example
I will get this message: No matching function for call to “WiFiClass::setCredentials(String&, String&, int)”
However, if I were to do WiFi.setCredentials(“MY_SSID”, “MY_NETWORK_KEY”, WPA); then it will work fine.
Thank-you all for your prompt reply.
My apology for not being as prompt.
Just tried out your suggestions, both were very valuable for me to solve my problem.
Now the function WiFi.setCredentials works for me.
If I may, can I ask this follow up question?
Is there a way to get the WiFi credentials (all, SSID (there is a function for this WiFi.SSID() - so that one is ok), but the KEY and the AUTH method) of the existing setup in the Core?
The reason why I am asking this is for reverting back to the old parameters in case the new setting won’t work. Example: if I set WiFi.credentials(“NewNetwork”, “NewKey”, “NewAuth”)… if not connected properly I would like to revert back to the old parameters (having of course saved the old ones somewhere). But I don’t know how to get the old KEY or the old AUTH type.
The Core (actually the CC3000 chip) can store up to 7 credentials, and will try them all to find a working one. So if it turns out your new ones don’t work, it’ll try the next one.
Thanks.
As you saw in my other post for resetting to factory default. It does not seem to be so. As my Core was working until I tried to set to AUTH = WEP. It could not connect to the network - neither the WEP nor the previous one (WPA).
@blondie63, have you actually read and understood my post???
Have you tried Serial.print()?
Have you understood what I meant with the extra byte?
Have you read the post from @peekay123, near the top of this thread?
I guess you had several people commenting on other threads to engage your own brain and not only rely on the crowd.
@Hootie81, while toCharArray() would help with copying, it would not actually help the main problem of possible memory corruption (where the effect, if it causes a crash or not, might depend on the length of the string literals due to the compiler placing variables on 2/4 byte boundaries - these errors will be a bitch to track down, if you happen to change the literals - first it works and next it doesn’t, and “no one” knows why!).
For your use I’d guess the easiest way would be to just forget about the char-array and use c_str() in the call to setCredentials() directly.
But to understand the length problematic, @blondie63 should stick with this aproach to get it working and take something home from it.
Exactly, that was one of the reasons (possibly the main) why your code above didn’t work.
To see how this actually was the problem, you should try my suggestion to print out the contents of your ssds, psws, mySSID and password before you added the +1.
Could you post your print out results and an interpretation of it too?
It’s really interesting if you do and you might learn a lot from it - e.g. if you had your pwd just one char longer it would have worked right away, but still wouldn’t be safe.