Skip to content

Instantly share code, notes, and snippets.

@cluelessperson
Created July 11, 2020 03:08
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/f6556fa0f924315e06b44095b1988129 to your computer and use it in GitHub Desktop.
Save cluelessperson/f6556fa0f924315e06b44095b1988129 to your computer and use it in GitHub Desktop.
#include "Arduino.h"
#include "common/common.h"
void setup() {
leds_setup();
Task wifi_task = wifi_setup(ts);
}
void loop() {
ts.execute();
}
#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);
return wifi_task;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment