Developer walk-through for the "rt_queued-state-machine" LabVIEW project available for download at https://learn-cf.ni.com/teach/riodevguide/code/rt_queued-state-machine.html that covers this topic: "State machines perform system control, data processing, and any task that involves executing a sequence of activities in response to inputs from the surrounding physical system, the user interface, and other processes within the system. The queued state machine is a particular implementation style that is flexible and versatile, easy to maintain, and computationally efficient."
See the "RIO Developer Essentials Guide for Academia" available at https://learn-cf.ni.com/teach/riodevguide for more video tutorials related to programming, architecting, and networking with LabVIEW and NI Academic RIO products.