Main Content

In my first Instructable Motion Activated Automatic LED Stair Lights with Arduino I mentioned the use of “Cooperative Multitasking”. So what is it and why is it helpful?
This Instructable attempts to answer the “what is it” and “why is it helpful” question with a simple example that step by step builds up into a more complex example. The end result will hopefully answer an additional question being “Cool! How can I do it?”.
As a bonus we will end up with a project consisting of some randomly blinking LED’s that will be almost as mesmerizing as a good old log fire - maybe even more so if you use enough LED’s! Even if you are not interested in cooperative multitasking, surely, mesmerizing, randomly blinking LED’s would be worth your while reading to the end!
This is quite a long instructable, but really it is several projects in one. Each of the projects builds upon the other. Primarily to illustrate how things might start out simple, but can get complicated very easily. Ultimately, a solution is presented that makes life much simpler. If you are time poor, or feel that things are progressing too slowly, you can skip some of the steps as outlined a bit later.
If you just want to get to building the Mega-Blink-Light project, simply read “the bits list”, “hooking everything up” and jump straight to the last step.
If you complete the steps in between, you will have the basis of a system that can manage multiple concurrent operations in your own projects.”

Link to article