Skip to content

Instantly share code, notes, and snippets.

@cluelessperson
Created July 11, 2020 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cluelessperson/e362d89a96c934d4bdd66c18b7000b17 to your computer and use it in GitHub Desktop.
Save cluelessperson/e362d89a96c934d4bdd66c18b7000b17 to your computer and use it in GitHub Desktop.
#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