Skip to content

Instantly share code, notes, and snippets.

@towynlin
Last active August 29, 2015 14:11
Show Gist options
  • Save towynlin/ac443a6aedb30c99637b to your computer and use it in GitHub Desktop.
Save towynlin/ac443a6aedb30c99637b to your computer and use it in GitHub Desktop.
Incorrect Spark Core Wi-Fi password timeout
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