Introduction
This example code will allow you to run a program continously, and have the option to log the data to file. When you click "Start Logging" the VI will create a new file and start logging your data to disk. When you click stop logging it will close the file and wait untill you start again.
Code
This code uses a state machine aritecture, to navigate between 5 states:
Initilize
Idle
Create File
Log Data
Close File


NOTE:
You will get an error if the given file name allready exists. If you want to make sure it generates a new file name everytime take a look at: Generate Unique File Path and Create File