SparkFun will be closed for Memorial Day (5/30). Orders placed after 2pm MT on Friday (5/27) will process and ship out on Tuesday (5/31).

Member #148178

Member Since: August 25, 2010

Country: United States

  • I also come from a hardware background and when I began programming state machines the most difficult part was how to actually draw the state machines. However, once I figured out that the state transitions should be some sort or event (button press, timer tick, message received, etc) it made things a lot easier.After that I was constructing state machines using the good ‘ol switch statement.

    Then I came across this interesting post and my whole paradigm shifted forever. http://fabioutzig.com/2013/06/21/table-driven-state-machines.html Instead of constructing a state machine in switch statement I now write them in a table. It is so much easier to read, easier to edit, easier to debug. With more then just a few states the switch statement quickly gets out of control and unmanageable. With the ‘table-driven’ method everything is much cleaner. Sometimes a switch statement is just great especially where the processing is simple and needs to be very fast, but for more complex application level state machines the ‘table-driven’ method is king!

  • http://www.youtube.com/watch?v=IjeIPP7dRDk

    That video helped me out. Also, the data sheet and user manual above are fairly detailed.

No public wish lists :(