Skip to content

Instantly share code, notes, and snippets.

@towynlin
Last active August 29, 2015 14:11
Embed
What would you like to do?
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