Go into listening mode if no known networks are available

Resurrecting the thread, sorry. Seems to make more sense to keep it here.

Both the proposed code sets are failing for me. I’m building on 0.8.0-rc11 using the Web IDE. (EDIT: downgraded and tested on 0.7.0 with same result).

When using @AaronD 's code (shared) and below, it works fine when the WiFi network is present. I see 3 blue flashes and it connects. However, when the WiFi is not present (also when present but not connected to the internet), it goes through a cycle with red flashes/green but never enters blue flashing listening mode (the flashing is fast and crazy in a way I can’t follow whether it is an SOS or simply no internet/cloud connection).

I feel telling, there is neither the expected 6 LED flashes nor 3.

On the other hand, @nrobinson2000 's post #7 code when WiFi is present never connects and remains in green breathing state. I can’t figure out what the problem is.

I’ve re-read the docs on all the WiFi instructions and can’t seem to find anything wrong with either code…yet neither works.

#include "Particle.h"
#include "softap_http.h"

SYSTEM_MODE(SEMI_AUTOMATIC);
SYSTEM_THREAD(ENABLED);

                                            // INITIALIZE VARIABLES =================================

int LED = D7;                               // LED = onboard LED pin (D7).
bool newWiFi = false;                       // Flag to indicate looking for new WiFi credentials.

STARTUP(WiFi.setListenTimeout(120));         // Set max time to listen for new WiFi credentials.

                                            // SETUP ================================================

void setup() {
    pinMode (LED, OUTPUT);                  // Set LED pin to OUTPUT mode.

    WiFi.on();                              // Do manual WiFi initialization
    WiFi.connect();
    if(waitFor(WiFi.ready, 15000)) {        // Wait 15 seconds to find WiFi network
        for (int i = 0; i < 3; i++) {       // 3 Flashes = we have WiFi.
            digitalWrite(LED, HIGH);        // Send signal then...
            delay(100);
            digitalWrite(LED, LOW);
            delay(100);
        }
        Particle.connect();                 // Connect to Particle Cloud.
    }
    else {
        for (int i = 0; i < 6; i++) {       // 6 Flashes = no WiFi found after 15 sec.
            digitalWrite(LED, HIGH);        // Send signal then...
            delay(100);
            digitalWrite(LED, LOW);
            delay(100);
        }
        WiFi.disconnect();              // Disconnect WiFi.
        newWiFi = true;                 // Set flag to say we are listening for new WiFi credentials.
        WiFi.listen();                  // Listen for new WiFi credentials.
    }
}

                                            // MAIN PROGRAM LOOP =====================================

void loop() {
    if ((newWiFi) && (!WiFi.listening())) {
        System.reset();                     // If newWiFi and ListenTimeout already expired, reset.
    }

// Do Stuff()                               // Do rest of loop() code which will run while listening for new WiFi credentials.

}