09-15-2017 03:26 AM
Hi Guys,
I'm doing a project that will datalog the voltage reading from Arduino A0 pin. The arduino will read the voltage reading every "N" times (depends on time delay) and save the overall reading into excel. The problem is, I can't stop the VI anytime I want.
seems like it will wait first before the delay is finished. see the attached picture
Solved! Go to Solution.
09-15-2017 03:41 AM
Put the time delay in the false case of an case structure. Wire the stop button to the terminal of the case structure. I have build an example
09-15-2017 04:27 AM - edited 09-15-2017 04:29 AM
09-15-2017 04:34 AM
So to abort the delay you can abort the SubVI.
09-15-2017 04:46 AM
09-15-2017 04:52 AM - edited 09-15-2017 04:53 AM
@GJMABerends wrote:
So to abort the delay you can abort the SubVI.
I think it is best practise to use the abort VI function only if you have absolutely no ther option.
09-15-2017 05:16 AM
Hey GerdW
Probably he doesn't agree. I agree these suggestion that I made were not great. I should pause and look at the problem more carefully before I suggest a solution. I assumed that the question was about stopping a Time Delay without thinking about the actual question.
The first solution has indeed the issue that it doesn't stop an already started time delay. The second solution stops the time delay but forces the application off while not closing references properly.
09-15-2017 05:58 AM
@GerdW wrote:
Hi Gert-Jan,
usually you don't want to abort a VI somewhen in the middle of doing something important…
(What does Wiebe say about your recommendations? :D)
Well, "Abort" is about the only way to stop a time delay. So I think it should be the accepted answer!
Let's stay on topic for once! How to avoid having to stop the time delay is another (the correct) question.
09-15-2017 06:42 AM
Place the code in an event structure in the timeout case (timeout = rate), then you can have a Stop Value change event that'll stop at any time.
/Y
09-15-2017 06:45 AM
I think it's suppose to run on Arduino (not sure), so no event structures.