Last active
August 29, 2015 14:11
-
-
Save towynlin/ac443a6aedb30c99637b to your computer and use it in GitHub Desktop.
Incorrect Spark Core Wi-Fi password timeout
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
SYSTEM_MODE(SEMI_AUTOMATIC); | |
bool wasConnecting = false; | |
int startedConnectingAt = 0; | |
void setup() { | |
Spark.connect(); | |
} | |
void checkForTimeout() { | |
if (wasConnecting) { | |
if (millis() - startedConnectingAt > 40000) { | |
wasConnecting = false; | |
WiFi.listen(); | |
} | |
} else { | |
wasConnecting = true; | |
startedConnectingAt = millis(); | |
} | |
} | |
void loop() { | |
if (WiFi.connecting()) { | |
checkForTimeout(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment