From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-14-2014 11:02 AM
Dear GerdW,
Thanks for this suggestion. I tried to implement it, but it does not really work as I want.
In the attachment you can find my example code:
If I run the vi and press on the Calculate button, values will be filled into both arrays.
If I want to delete the data of Array1, I click on the Calculate button again (to stop the calculation) and then I click once on the Delete Data button.
Array1 will be deleted then, but I have to wait 5s until the test if the Delete Data button is pressed more than 5 s is done (if so, Array2 will be deleted too ). In these 5 s I cannot do anything and this is something which I want to avoid.
Can you give me a hint how I can adapt my program to avoid this problem?
07-14-2014 11:27 AM
Try changing the mechanical action of your delete button to Switch Until Released. This will cause a Value Change event when you press the button and when you release it. So you just store the time when you pressed the button in a feedback node. When you release, you subtract the current time from the previous time. If it is more than 5 seconds, delete your second array.
07-14-2014 12:25 PM
Dear crossrulz,
WOW, this is almost exactly what I want to have!
Would the following be possible:
When I press Delete and wait for 5 s, I want that Array2 is deleted after these 5 s without releasing the Delete button.
At the moment I have to press the Delete button for 5 seconds (slowly counting up to 5). After releasing it I will see if I pressed long enough. If I had luck, I waited long enough and Array2 is deleted. If I have bad luck, I have to press again on Delete.
So, it would be great if your program could be slightly adapted.
07-14-2014 01:08 PM
@partial wrote:
So, it would be great if your program could be slightly adapted.
That's simple enough. You just put a timeout value in a shift register. When you initially push the button, set the timeout to 5000 (5 seconds) and clear array 1. In your timeout you clear array 2. If you release the button too soon, you will still get the value change, but you want to set the timeout to -1 (wait forever). This will keep the Timeout case from running and clearing your array.
07-14-2014 03:56 PM
Dear crossrulz,
Thank you very much for your explanations and your new code.
I was able to adapt it to my real program and it works fine!
Thanks a lot for the help!
07-15-2014 12:59 AM
The way crossrulz explained was the same way i solved it in the end.
https://decibel.ni.com/content/docs/DOC-11639
(if you need some more stuff )
07-15-2014 01:41 AM
Dear jobauer,
I found your nice program in advance. But unfortunately I did not recognize that I can adapt this program too.
But the whole discussion here helped me a lot to learn and understand more about how to use Event Structures.