Particle.function vs. loop()

I assume that a Particle.function is never executed while loop() is being executed.

That depends on what happens inside loop() and whether you are using SYSTEM_THREAD(ENABLED) or not.

Particle.process() and delay() might open a door for cloud functions during loop()

1 Like

@douglaskbell to add to what @ScruffR said (from documentation):

Cloud functions registered with Particle.function() and event handlers registered with Particle.subscribe() continue to execute on the application thread in between calls to loop(), or when Particle.process() or delay() is called. A long running cloud function will block the application loop (since it is application code) but not the system code, so cloud connectivity is maintained.

the application continues to execute during listening mode
the application continues to execute during OTA updates

2 Likes