Finite State Machine (FSM) of a custom vending machine implemented in C++ program.
When the user puts in money, money counter tells the control unit, the amount of money inserted in the Vending Machine. When the user presses the button to purchase the item that he wants, the control unit turns on the motor and dispenses the product if correct amount is inserted. If there is any change, machine will return it to the user. The machine will demand for servicing when the products are not available inside the machine.