Created
July 11, 2020 02:56
-
-
Save cluelessperson/e362d89a96c934d4bdd66c18b7000b17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "wifi.h" | |
#include <ESP8266WiFi.h> | |
#include "TaskScheduler.h" | |
Task * wifi_setup(Scheduler &s) { | |
WiFi.mode(WIFI_STA); | |
WiFi.setAutoReconnect(true); | |
WiFi.begin(WIFI_SSID, WIFI_PASS); | |
#ifdef WIFI_HOST | |
WiFi.hostname(WIFI_HOST); | |
#endif | |
Task wifi_task(TASK_SECOND, TASK_FOREVER, [](){WiFi.waitForConnectResult();}, &s, true) wifi_task; | |
return &wifi_task; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment