Hey all,
I'm having an issue getting the WiFi library to play nice with my wpa_supplicant (well WiFi in general). I have setup and configured WiFi. I am able to ping a URL successfully. The problem arises when I try to upload any sketch that uses the WiFi libraries. Doing so results in the wpa_supplicant file being removed. Verifying that the WiFi works, I upload the sketch below (again any WiFi sketch) and see one line in particular that is worrisome (sketch uploads just fine):
"wlan0: deauthenticating from ... to local choice (reason=3)"
After this happens I the wpa_supplicant.conf is removed from the /etc/ directory. What I have noticed is that all the WiFi example sketchs assume that a WiFi connection has to be established. In my case I have configured WiFi to run aromatically so the connection is pre-established. How do I go about programming for a connection that already exists. Any suggestions are welcome. WiFi comes back online after I reconfigure the wpa_supplicant. I seems to me that there WiFi library assumes there is nothing configured and removes and configures the connection each time. Seems inefficient, but I am no expert in this space.
Below is the simple sketch that simply queries WiFi connectivity. Again, before the sketch upload I ping a URL and it returns successfully, during the sketch upload process the wpa_supplicant is removed.
#include <WiFi.h>
int status = WL_IDLE_STATUS;
void setup() {
// put your setup code here, to run once:
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a WiFi connection");
}else{
Serial.println("WiFi connected!");
}
}