Link to video: https://youtu.be/TH__MdQD_GA
This is PART TWO of the Bacon Bytes series on a step-by-step guide on how we can move to a State Machine on the Arduino (or, indeed, any other microcontroller).
To get the most of of this video ensure you have watched PART ONE first which covers the whole multi-tasking element of a useful State Machine that doesn't include any blocking code (such as use of the delay()☠statement).
Link: https://youtu.be/hwEo49yyU88
We briefly (ever so briefly) touch on theory but really concentrate on converting a State Diagram into actual Arduino-speak C++ code. It's far easier than you might think.
Moreover, it ensures your code reflects the State Diagram you draw, thus ensuring excellent robustness in your code.
You know about enums? What about class enums? We cover that too, and why it makes for better, more robust code.
Perhaps in a future video we might even talk about Hierarchical State machines 😲
If you really want some in-depth theory, Wikipedia has it covered:
https://en.wikipedia.org/wiki/Finite-state_machine
► List of all my videos
(Special thanks to Michael Kurt Vogel for compiling this)
http://bit.ly/YouTubeVideoList-RalphBacon
► If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite (and other μControllers) journey
My channel, GitHub and blog are here:
------------------------------------------------------------------
• https://www.youtube.com/RalphBacon
• https://ralphbacon.blog
• https://github.com/RalphBacon
• https://buymeacoffee.com/ralphbacon
------------------------------------------------------------------