To download NI software, including the products shown below, visit ni.com/downloads.
The State Machine is one of the fundamental architectures LabVIEW developers frequently use to build applications quickly. State Machine architecture can be used to implement complex decision-making algorithms represented by state diagrams or flow charts.
State Machines are used in applications where distinguishable states exist. Each state can lead to one or multiple states, and can also end the process flow. A State Machine relies on user input or in-state calculation to determine which state to go to next. Many applications require an "initialize" state, followed by a default state where many different actions can be performed. The actions performed can depend on previous and current inputs as well as states. A "shutdown" state can then be used to perform clean up actions.
This vi uses State Machine architecture to perform the functions of a Coke machine.
You can also see a vi that performs the same function that uses produce consumer architecture at https://forums.ni.com/t5/Archive-TKB/Producer-Consumer-Example-Coke-Machine/ta-p/3504030
Description-Separate-2
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
The link to the producer consumer version is broken:
http://decibel.ni.com/content/docs/DOC-2145