ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about Variable

Hello, wanna ask something about the variable.

Screenshot 2024-05-04 002828.pngScreenshot 2024-05-04 002904.png

This is the sample program i made, the indicator show 0 when i didnt press the pushbutton and show 1 when i press it. however, it turn back to 0 when i release it, is there anyway to keep it as 1 when i release it and the value will keep increasing when i press it?

0 Kudos
Message 1 of 7
(1,215 Views)

Attaching an image does not tell us the entire story. Please attach your VI.

 

  • There is no toptlevel while loop. Are you using continuous run mode? Please don't!
  • What is the mechanical action of the switch?
  • Why are you using a local variable. Where is the terminal of that indicator?
  • In LabVIEW, the wire is the variable! Terminals are just UI devices.
  • To increment a value, you need to keep the current value in a shift register or feedback node.
  • etc. etc.

 

0 Kudos
Message 2 of 7
(1,208 Views)

See if this can give you some ideas:

 

altenbach_0-1714755382660.png

 

0 Kudos
Message 3 of 7
(1,206 Views)

IF you go to the front panel and right click on the boolean control then select MECHANICAL ACTION there are a few options 

 

To do what you want you must select SWITCH WHEN PRESSED 

 

0 Kudos
Message 4 of 7
(1,160 Views)

@LVNinja wrote:

To do what you want you must select SWITCH WHEN PRESSED 


 

... But they said: "and the value will keep increasing when i press it?" That is " ... until released".

 

Nothing will be increasing without a shift register or feedback node and proper top-level architecture. 🙂

 

Of course it could also mean that it should increment by one for each press, in that case latch action would be correct 

0 Kudos
Message 5 of 7
(1,138 Views)

Hi, I'm sorry for not attaching VI

 

1. Yes, Im using continuous run mode, because i dont want the program to end in one run.

2. the mechanical action is switch when press

3. I put it somewhere else, it is not connected to anything. but the result will be the same even if i use the indicator.

 

0 Kudos
Message 6 of 7
(1,107 Views)

it is

0 Kudos
Message 7 of 7
(1,106 Views)