LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use boolean push button as a constant to add to other values

Solved!
Go to solution

Hello all, I am trying to use a boolean OK button and a constant to make something similar to the calculator project I've read about in other posts. I labled the button $1.00, $0.25, ......  So on.  I just want to add the value to an indicator every time I push the button.

The closest I can get is the vaue is displayed while I hold the button in and the it goes to 0 as I realese it. I want it to add up each time its pressed.

 

Thanks in Advance

Kevin

0 Kudos
Message 1 of 12
(7,940 Views)

Without seeing any of your code so that we know what you have done, I'm going to guess that you failed to use a shift register to store the value that you add to every time you press a button.

Message 2 of 12
(7,928 Views)

sample VI.png

This is the VI that I started with. I will read on in the help info as to how to use a shift register. If you have a simple way to explain how a shift register works that would be appreciated.

Thanks for your time.

KP2 

0 Kudos
Message 3 of 12
(7,897 Views)

Do you have a while loop with your code?  Right now it looks like your VI just runs once.

 

(Please do not say you are using the Run Continuously button.)

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Message 4 of 12
(7,891 Views)

Hi

The best way to do it is by using an Action Engine. Look for a Nugget made by Ben and describing Action Engine (it is worth every second of your time spent of that). As a matter of fact, the action you need to do is a beautiful example of an Action Engine.

regards

N

Message 5 of 12
(7,883 Views)

Yes I was using the run continous button. 😞 but in my next attemt got me closer and now I tried this next example and this works, SO FAR. I still need it to reset the shift bit like a clear button. I'm close, thanks for your help.

KP2

Getting Closer.png

0 Kudos
Message 6 of 12
(7,862 Views)

Not sure where to look for the action engine.

0 Kudos
Message 7 of 12
(7,861 Views)
Solution
Accepted by topic author KP2

Hi Kevin, this is Paul from Applications Enginering at NI.  Try something like in my attachment.  You can use case type statements to evaluate whether a button was pressed, then assign that true case a value.  Good luck with it

Dollars and Cents.png.

 

 

Paul Davidson
National Instruments
Product Owner - ni.com Chat
Message 8 of 12
(7,858 Views)

 


@KP2 wrote:

Not sure where to look for the action engine.


Search : Action Engine Nugget Ben

 

Message 9 of 12
(7,852 Views)

Thanks Paul, that works great. Smiley Very Happy

0 Kudos
Message 10 of 12
(7,835 Views)