State machine

Moore

 * from https://stackoverflow.com/questions/1371460/state-machines-tutorials
 * http://web.archive.org/web/20160517005245/http://www.gedan.net/2008/09/08/finite-state-machine-matrix-style-c-implementation
 * http://web.archive.org/web/20160808120758/http://www.gedan.net/2009/03/18/finite-state-machine-matrix-style-c-implementation-function-pointers-addon/
 * http://www.newty.de/fpt/intro.html function pointers and why to use them. https://web.archive.org/web/20160328063247/http://www.newty.de/fpt/zip/e_fpt.pdf and source files http://www.newty.de/fpt/zip/source.zip
 * DeLoura, Game programming gems chapter 3 on state machines p.215
 * Real-Time Object-Oriented Modeling 1st Edition, Bran Selic

actions
https://stackoverflow.com/questions/33569250/state-machine-timer-self-transition A state machine changes state when a specific event occurs. Also a state machine has two more things, on entry and on exit actions, on entry, the actions that occur when a state machine enters into another state, on exit, the actions that occur when you leave a state, to enter another. Ex: wait state, on entry, start a timer (or counter) for 5 seconds, enter the state, change state when timer is finished (the event to change state), on exit, stop the timer (or reset counter), move on to the next on entry action for the next state. https://stackoverflow.com/questions/1647631/c-state-machine-design

github
https://github.com/misje/stateMachine

Hackaday
https://hackaday.com/2018/04/06/state-your-intentions-more-clearly-with-state-machines/#more-302326

https://hackaday.com/2015/09/04/embed-with-elliot-practical-state-machines/

https://github.com/pgularski/pysm and https://github.com/TelluIoT/ThingML

https://hackaday.com/2015/08/13/becoming-a-state-machine-design-mastermind/ In C, my favourite way of representing a state machine is with state handler functions, taking an event pointer as an argument and returning a function pointer to the function representing the next state. It is readable, compact, fast and easy to add new states and events. links to https://www.easycode.de/download/software.html?L=1 for state machines

compilers
http://smc.sourceforge.net

mealy
http://gameprogrammingpatterns.com/state.html

https://www.norwegiancreations.com/2017/03/state-machines-and-arduino-implementation/

https://www.state-machine.com/, https://www.youtube.com/watch?v=O0Z1D6p7J5A&list=PLPW8O6W-1chwyTzI3BHwBLbGQoPFxPAPM&index=19

https://aticleworld.com/state-machine-using-c/

https://www.embedded.com/design/prototyping-and-development/4442212/Implementing-finite-state-machines-in-embedded-systems

instructables
https://www.instructables.com/member/Ren%C3%A9B2/

https://www.instructables.com/id/Finite-State-Machine-on-an-Arduino/

https://www.itemis.com/en/yakindu/state-machine/

snippets
https://web.archive.org/web/20150905150146/http://contrarymotion.net/2008/02/12/some-code-snippets-for-a-simple-c-state-machine/

http://www.techranch.com/blog/index.php?entry=entry070331-214629

ragel
http://www.colm.net/open-source/ragel/

wikipedia
https://en.wikipedia.org/wiki/Event-driven_finite-state_machine

https://en.wikipedia.org/wiki/State_transition_table

structured
https://www.codeproject.com/Articles/37037/Macros-to-simulate-multi-tasking-blocking-code-at#_Toc310 This is a set of macros that can be used to write structured code as if it were blocking code while in an interrupt context. See Gentlenav UAV project, plain c code and interrupt driven, avoids the category error or category mistake that is Oop.

youtube
https://www.youtube.com/watch?v=Ol6x5mjeu4w from https://www.amritaryal.com.np/posts/categories/microcontrollers/3.html millis on arduino to multitask see https://create.arduino.cc/projecthub/mdraber/using-millis-function-as-an-alternative-to-using-delay-9cea63 https://www.youtube.com/watch?v=pxaIyNbcPrA How to translate a Finite State Machine into firmware code, using C++ function pointers.

https://www.youtube.com/watch?v=2OiWs-h_M3A Gary explains

commercial tools
https://www.itemis.com/en/yakindu/state-machine/

links
https://www.edn.com/function-pointers-part-3-state-machines/ or https://archive.ph/bez40

PID control AtmelMicro Chibios