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).
Track My Order
Frequently Asked Questions
International Shipping Info
Mon-Fri, 9am to 12pm and
1pm to 5pm U.S. Mountain Time:
Chat With Us
August 25, 2010
News - State Machines: blink.ino…
about a year ago
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.
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!
about 3 years ago
That video helped me out. Also, the data sheet and user manual above are fairly detailed.
No public wish lists :(
Forgot your password?
No account? Register one!