Conclusion:

In this guide we have demonstrated that it is indeed possible for the Arduino to juggle multiple independent tasks while remaining responsive to external events like user input.

  • We’ve learned how to time things using millis() instead of delay() so we can free up the processor to do other things.
  • We’ve learned how to define tasks as state machines that can execute independently of other state machines at the same time.
  • And we’ve learned how to encapsulate these state machines into C++ classes to keep our code simple and compact.

These techniques won’t turn your Arduino into a supercomputer.  But they will help you to get the most out of this small, but surprisingly powerful little processor.

In the part 2 of this series, we'll build on these techniques and explore other ways to make your Arduino responsive to external events while managing multiple tasks.

Last updated on Nov 23, 2015 Published on Nov 03, 2014