LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time recording when the button is pressed

Sorry for my English... 😢

  1. Yes, I want the time to reset to zero after the button is released (when it goes from true to false). This will be useful for viewing several CSV files so that the time count starts from 0 in each file as a starting point.

  2. I want to integrate this part of the code into my main loop, where data collection, image viewing via AVI, etc., take place. I can send you the parts of the code that should work together, but only if you're okay with that. I would, of course, be very grateful for your help.

  3. Could you recommend good sources to help me fill in the gaps I have, which, as I understand, you noticed right away? Because in general, the available resources either focus on simple examples or on solving complex problems, but there isn't much in between at a basic-to-medium level.
0 Kudos
Message 11 of 12
(149 Views)

So, if I understand correctly:

 

  1. The program starts with the button off, waiting for user input.
  2. Once you turn the switch to true, it will start recording to a file and the first point has t=0
  3. It will continue recording with time increments corresponding to the loop rate
  4. Once you turn the switch off, it will stop recording
  5. Next time you switch to true, it will open a new file and again star recording from t=0
  6. continue with step 3, etc

 

Obviously, you need to create a new file name with each new recording. How should that file name be generated? Easiest would be for the user to give a root file name tag (e.g. "ABC" and the program would generate ABC000, txt, ABC001,txt, and so on, one for each recording.  You also need to decide what should happen if a file with the same name already exists (overwrite? generate an error? not record? something else?). 

 

All this would be trivially easy to implement starting with the code skeleton I already gave you. Just turn it into a proper state machine and things will fall into place.

0 Kudos
Message 12 of 12
(129 Views)