Infinite loop in loop function and cloud update

Is my interpretation correct ?
if the loop funciton contain an infinite loop, the update of the firmware via the cloud will not be possible any more ?


In what way? The spark should update firmware before initializing any code. The main loop is infinite and runs forever so another loop inside it shouldn’t make a difference but to run the same as the main void loop

As the scripts are loaded after the main bootloader it shouldn’t have any effect. If you mean live updates via the cloud, I believe you could change the mode if it locks out, but it should stop the code from running when new firmware is sent to the spark no matter what

@lemouchon , The user loop() function is called inside the core’s main event loop, and can be called thousands of times a second. It’s good practice not to block that function for longer than 10 seconds or so, since the core pings the server every 15 seconds to make sure it’s still online.

1 Like

tanks for your reply and clarifications


Is this true even if the user space loop never terminates? I.e. I recall someone saying the wifi connection drops if one iteration of the main loop takes more than 15 seconds to execute.

@lemouchon @amanfredi My original post was not quite correct, :frowning: Just edited my post to be correct. Sorry for the confusion.