Abador, I’m glad you chose the Spark for the reasons you did. However, you are working under false assumptions:[quote=“Abador, post:7, topic:3728”]
but if I understand correctly if the sketch works too long it may interfere with the background services
This issue was resolved some time ago by modifying the delay() function, which is used often, to allow background processing during the delay. If your loop() simply processes so much that it does not return control to the background task in less than 10 seconds then you just need to sprinkle some SPARK_WLAN_Loop() calls in there to keep the background happy.
I just finished a program where I wanted sampling to take place in my loop() with wifi and cloud connection disabled. Then, every minute, I enable the wifi and cloud connection, publish some data and then disable wifi and cloud again. I measured about 37ma draw on the 5V USB line during data collection and about 310ma during publishing, which lasts just a few seconds at most. I also supply power to a couple of peripherals so I am measuring everything, not just the core. Perhaps this approach could work for you.
Another similar method is the sleep mode using Spark.sleep(), though like my code, it only disables the CC3000 and does not turn it off. Which brings up an interesting question that I will take up with the Spark Team - can there be a “deep” WiFi.off() function which shuts down the CC3000 completely?