Asynchronous Functions?

Hello everyone!

I am still relatively new to both the Particle ecosystem and Arduino as a whole. I am developing a script right now and I would like to use Asynchronous functions and to execute two separate threads of code. Can someone explain to me the capability of the Particle Device OS in terms of multithreading and asynchronous code? I read in the documentation that the the Device OS has asynchronous functionality for managing network and background process, but does that also extend to custom functions?

Thanks in advance!

You can do asynchronous programming a few different ways on Particle devices.

One is to use finite state machines or chained callbacks (like node.js). The Particle.publish API also supports Futures.

The other is to use threads.

All work just fine on Particle devices.

1 Like