Fsm In C


Finite State Machine.
It has a set of states that follow a certain path. A state has transitions to other states, which is caused by events or actions within a state.


You are in the kitchen (state) and you felt a sudden urge to drink water. You then decide to walk over to the cupboard and grab a glass. This is an event (walk to cupboard) and you are now in a new state with new options available to you. You then open the cupboard (action) and grab a glass (action). With the glass, you walk over to the sink (event) and turn on the tap (action). Water into poured into the glass (event) and you then drink it (action).


Here is a list of terminology used throughout the tutorial. If any of these seem unfamiliar to you, it would be helpful to know what they mean before continuing on with the tutorial. They are as follows:

  • FSM A collection of states and transitions that outline a path of actions that may occur.
  • State A state is a position in time. For example, when you are at the bus stop, you are currently in a waiting state.
  • Event An event is something that happens in time. For example, the bus has arrived.
  • Action A task performed given a certain event that occurred. For example, you enter the bus.
  • Transition A link between 2 states. May be unidirectional or bidirectional.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.