The open source QP state machine framework for Arduino has been just released (see http://arduino.cc/playground/Code/QP).
The QP framework very nicely complements the Arduino platform and provides everything you need to build well-structured, responsive, robust, and power-efficient Arduino programs based on modern hierarchical state machines. In many ways the open source QP state machine framework is like a modern real-time operating system (RTOS) specifically designed for executing event-driven state machines.
The QP development kit for Arduino provides also an example model for the free QM graphical modeling tool. QM takes Arduino programming to the next level, by eabling automiatic code generation of complete Arduino sketches.
The extensive Application Note “Event Driven Arduino Programming with QP” describes the main concepts and how to get started.