Then again, it also has a search function, but simply browsing through it wouldn’t hurt either
Let me know if that helps or if you require further information.
@Moors7 Thanks for the links, I’ve take a look a them, but I’m still not sure how to do what I want.
I would need something like this:
if(no network known available after 60 secondes){
WIFI.LISTEN();
}
But I don’t know I to do this and I don’t really understand how to run code when the Photon is offline.
I think that this function should be by default. Like the Chromecast: when there is no known network available, It enter in listening mode while checking if there is still no known network available.
@ScruffR for the button, I would need to use the pins of the Photon only.
Nope, that would counteract intended default use of the device. You can take it away from one known network and it should still carry on doing its other duties (sensor reading, controlling, ...) and when it aproaches another known network just join this and offload its collected data.
If you read up on SYSTEM_MODE() and SYSTEM_THREAD(ENABLED) in the docs, you’ll see
SYSTEM_THREAD(ENABLED)
SYSTEM_MODE(SEMI_AUTOMATIC)
uint32_t msWiFi;
void setup()
{
Particle.connect(); // since SEMI_AUTOMATIC it needs to be done in code
waitFor(Particle.connected, 10000); // wait for the connection but 10sec at the most
}
void loop()
{
if (WiFi.ready()) // if the WiFi is connected and ready
msWiFi = millis(); // rember when it last was seen ready
if (millis() - msWiFi > 60000) // check how long ago WiFi was seen reads (usually some nano sec)
{ // but if it was more than 60sec
WiFi.listen(); // go into Listening Mode
waitUntil(WiFi.ready); // stall loop here till WiFi is readily connected
Particle.connect(); // once it's ready start connecting to the cloud again
}
// do some stuff
}
Or you could use the SoftTimers instead of the "manual millis()" way