Necessary loop intervals or delay timing for Spark API Housekeeping?

Continuing the discussion from LCD display getting corrupted:

Continuing the discussion from Known issue: long delays or blocking code kills the connection to the Cloud:

I have a few questions on timing. While using a modified version of the I2C scanner code, I had some bad if logic that basically kept the core in a while loop. It was printing the same variable to serial, instead of incrementing and completing. Also I didn’t have any delay statements (or minimal delay). I couldn’t reflash or make an api/variable calls.
Is there guidelines on the amount of time necessary to let the spark core do internal cloud housekeeping aka connections? As in I should have x amount of millis or delay statements or finish the main loop every x seconds? I hope this make sense. I’ve also read that if you have too much delay, things can get “weird”.Thanks!

You should allow for the cloud keeping at least once every 10sec - better more often.
If you want delay() to do that internally you’d need a delay > 1000ms (11x 900ms would never call SPARK_WLAN_Loop()).

1 Like