WiFi.off/WiFi.on, Core vs Photon [SOLVED]

@Jack, a few words to make your code run on the Core - this way it will run on the Photon too.

If you intend to switch WiFi off you’d better use SYSTEM_MODE(SEMI_AUTOMATIC) to prevent any issues in the Core “background” task.
To be able to read sensors while not online, you might like to avoid delay() and rather go for a “soft delay” by use of millis().
WiFi.on() is not enough to be able to Spark.publish(), you’d rather need to call Spark.connect() and maybe check the connection status along with your soft delay timer to do your publishing.
For nowMilli you should use unsigned long (or uint32_t) rather than long.

I sure could whip up some working code for you, but I’d guess, you’ll enjoy finding the solution yourself even more :wink:

1 Like