- A finite state machine or finite state automaton FSA, finite automaton, or simply a state machine, is a mathematical model of computation.
- An FSM is Defined by a list of its States, its initial state, and the conditions for each transition.
- As shown in the figure, the main process starts when the coin is inserted, else there is a continuous checking of the coin been inserted or not. Once the coin is inserted, the same is sorted to check its authenticity and the value the value is added to the sum and the sum is compared with the cost of tea/coffee.
- In case if the sum has not yet reached the cost of coffee / tea, the control is again transferred to the state waiting for the coin.
- In case of the coins entered sum up to the cost of coffee / tea or more than its cost, the control is transferred to to the states shown on the right hand side of the figure
- In case if the sum is equal to the exact cost of the coffee / tea, the coffee / tea is dispensed out using a solenoid valve and the system returns back to start.
- In case if the amount entered is more, the extra amount is refunded and the coffe / tea is dispensed followed by again state transition to the beginning.
FIG: FSM for automatic coffee/tea vending machine
Please log in to add an answer.