Skip to content

Instantly share code, notes, and snippets.

@TareObjects
Last active August 22, 2018 03:52
Show Gist options
  • Select an option

  • Save TareObjects/2f7e15fb4d36d354256ef1ad6aa4ae7f to your computer and use it in GitHub Desktop.

Select an option

Save TareObjects/2f7e15fb4d36d354256ef1ad6aa4ae7f to your computer and use it in GitHub Desktop.
WiFi.mode(WIFI_STA);
sleep_ms(100);
WiFi.begin(testSSID, testPassword);
int count = 0;
int status;
while ((status = WiFi.status()) != WL_CONNECTED) {
sleep_ms(1000);
count++;
if (count == 5 || status == WL_NO_SSID_AVAIL) {
esp_wifi_restore();//<--- this is important!
WiFi.begin(testSSID, testPassword);
sleep_ms(1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment