Real-world applications with event driven / multithreading

@GrtVHecke,

Can you please tell me what experience you have programming on other micro-controllers?

  1. Disabling an interrupt does not disable the hardware timer with which it is associated so it will still fire at the defined interval. The IntervalTimer library has a function for ONLY disabling a timer's interrupt instead of disabling ALL interrupts so as not to affect the entire system.

  2. The loop() runs forever, ceding control to the background task for only 5ms or so (typically). Creating a set of finite state machines, coupled with timing loops should give you what you need. For example, I have a program which reads a sensor every 100ms into a small buffer. Every second I grab the buffer, calculate some values and update a display. Every 30 seconds, I (optionally) log those values to a microSD and every minute I Spark.publish() them. All these are timer based using the elapsedMillis library, are mutually exclusive and each are state driven (FSM) so they are not blocking. It is just a matter of designing to requirements.

  3. You can check out the Core II topic for more information: