Good evening, folks.
The situation I am currently in is that I am in the early stages of trying to develop a solution which will be predominantly used away from any form of wifi connection, but the intent is to give it a way to connect to the particle cloud when a switch is toggled.
I have used a version of @peekay123’s hack for this (from a thread back in June 2014), and have modified it so that it doesn’t use the deprecated spark_disable_wlan / cloud header files.
SYSTEM_MODE(SEMI_AUTOMATIC);
// ...
int ArmConfigSwitch = D7;
// ...
void setup()
{
pinMode(ArmConfigSwitch, INPUT_PULLUP);
// ...
if (digitalRead(ArmConfigSwitch) == HIGH)
{
WiFi.on();
while (WiFi.ready() != TRUE) //Wait for wifi to come ON
Spark.process();
Spark.connect();
while (!Spark.connected())
Spark.process();
}
// ... and continue on to the rest of the code, which just flashes some LEDs at the moment
Now then, when the ArmConfigSwitch (pin D7) is shorted to GND, the code begins executing normally and as it should do.
When the ArmConfigSwitch is shorted HIGH, the RGB LED on the core glows white briefly, and then sinks into a steadily breathing blue (at the same pace as the usual breathing cyan). If I then short the ArmConfigSwitch pin to LOW (GND) and press the reset button on the core, it goes back to flashing the LEDs as it should do.
At this point, there is no way to get the core back up onto the wifi or cloud, so it’s a quick factory reset and reclaim before re-flashing it again. Ideally I’d like to be able to flick a switch and hit the reset button to make it connect to the cloud in semi-automatic mode… but it’s eluding me.
If anyone can help me out with this it’d be sincerely appreciated.
Regards,
Steve