From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Once true in a loop

Solved!
Go to solution

Dear all

 

I need to count the times I press the true button for saving data. If I still pressing and the loop time is 1 s it continues counting the true times, but I only need to count once each time I press true button.

 

I share a small example from my code for better understan.

 

Please take note my LB is 2013

 

Best

CPalka

0 Kudos
Message 1 of 6
(1,285 Views)
Solution
Accepted by topic author cpalka

Hi CPalka,

 

so you only want to count rising edges?

Use quickdrop to easily place "BooleanCrossing" in your VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,278 Views)

Hi GerdW

 

Thanks for the help, it´s working now.

 

Best regards

CPalka

0 Kudos
Message 3 of 6
(1,255 Views)

All you probably need is set the button to latch action. No extra code needed. (right-click...mechanical action ...)

 

(Also note that counting should be done with integers (blue), not floating point numbers(orange)).

 

altenbach_0-1675548994712.png

 

0 Kudos
Message 4 of 6
(1,241 Views)

Hi altenbach

 

I need to save data until  releasing the saving button.

 

Best

CPalka

0 Kudos
Message 5 of 6
(1,130 Views)

@cpalka wrote:

I need to save data until  releasing the saving button.


Well, you never said that. 😄 I assumes that pressing the button would just add one log entry, for example.

 

You still don't need all these subVIs and complicated code. Here's how I would count how many times the "switch until released" button went from false to true.

 

altenbach_0-1675785786103.png

 

0 Kudos
Message 6 of 6
(1,057 Views)