Although most of us are happy to create Arduino sketches using procedural methods from C++ and other experiences, there are other methods and one of these is by using state machine programming. The operation of a state machine can usually be described by:
... having an initial state or record of something stored someplace, a set of possible input events, a set of new states that may result from the input, and a set of possible actions or output events that result from a new state
And this method has been demonstrated well by Arduino forum member JimboZa with their Arduino-based state machine to control an electronic turnstile.
His simulation takes all options of use into account, and is also an interesting example of a different method of programming. Furthermore they've provided a schematic for a simple electronic model as well.
Fore more information including the sketch and discussion, log in to the Arduino forum. And for more, we're on facebook, twitter and Google+, so follow us for news and product updates as well.
If you're looking to learn how to use an Arduino in various methods, you can't go past reading a copy of "Arduino Workshop - A Hands-On Introduction with 65 Projects” by John Boxall.
Arduino Workshop takes the reader from having zero knowledge about the Arduino platform, electronics and programming and leaves them with the know-how and instructions on everything from blinking an LED, to robotics, wireless data, cellular communications, motor control, sensors, Internet connected systems and more. For more information including a sample chapter and table of contents, visit the book page