Simple State-Machine and Cooperative Multitasking Model

I have just written an article on how to simplify the coding of complex tasks, similar to what is discussed in the pinned topic "Demonstration code for several things at the same time", but I hope the proposed template/workflow would make it easier to follow. The detail of the article is published here:

http://www.deeptronic.com/state-machine-and-cooperative-multitasking-model-simplify-complex-processes-programming-for-microcontroller/

The coding template is provided in two programming styles: traditional structural/functional programming and object oriented programming. Aske me anything about it and I'll try to give the best answer.

Swell, but did you need guidance?

It is a good well written article, but my eyes glazed over when attempting to read your code.
It seems to be written for a more advanced programmer who is new to microcontrollers than for the complete beginners most often encountered here.

If you truly wish to make it easier to follow I suggest you look at other Arduino tutorials and learn the conventions used to make it easier for beginning programmers to understand, such as one statement per line heavily commented describing exactly what is happening.

My 2 favorite Tutorials on the subject:
Demonstration code for several things at the same time

and the 3 part
Multi-Tasking the Arduino which also describes the 2 coding styles mentioned

I think it's a great little article, and that implementing a state machine class library might in fact be the right way to help beginners code cleanly by inheriting it to do their tasks.

I'll have to think about that one. If I can use this approach to code my stuff without bloating the binary generated, then I'll be convinced. :slight_smile:

Meanwhile I'm going to track that article!