LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read the number of times a user is clicking a boolean button control.

How can I read the number of times that a user has interactively clicked on and changed the value of a boolean button control.  I thought of using the "value (Signaling)" Property, but it is write-only, so can the number of generated event changes be read?  I have two buttons (button A and button B), and want to make sure that the difference in the number of clicks between buttons A and B does not exceeed a value passed into its while loop.  That value passed is not a constant, it changes each time the program is run.    
0 Kudos
Message 1 of 7
(3,892 Views)
you can make an event structure and add an event case for the boolean button and put a counter in that case by wiring a shift register to the outside loop and putting an increment function just in that case.
- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 2 of 7
(3,882 Views)
If you want to use a case structure, you could do as shown in the attached pic
0 Kudos
Message 3 of 7
(3,855 Views)
James,
 
It seems a bit odd to make the case structure "transparent" by making the timeout zero, then add a delay to the main loop instead. Then you keep the loop spinning doing nothing except monitoring the stop button. Seems pointless ot even use an event structure if you go that route.
 
I'd suggest eliminating the timeout case entirely and adding an event for the stop button instead. Place an indicator on the [i] terminal to see the difference. 😉
 
 
Message 4 of 7
(3,850 Views)
Altenbach
 
Thanks for the tip. I had been confused as to how the timeout case worked. 
 
 

 

Message Edited by James R on 03-14-2007 09:18 AM

- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 5 of 7
(3,839 Views)

I have two buttons A and B, and have to compare the difference in hits between them.  So do I place an event structure within a while loop for each button (2 buttons, 2 event structures, 2 while loops), or does it need to be one event structure with cases for both buttons whith in one while loop?  How do I pass the values of buttons A and B's hit counters out of the while loop in order to calculate the differences between them after each increment, not just the final count after the stop button is hit?  How would I make one stop button work to handle both buttons A and B?   I tried to place the actual stop button in one button A's structure and its global in B's structure, but It wont seem to let me use a local variable for a latchable control.

Checker.  

0 Kudos
Message 6 of 7
(3,807 Views)
Hello,
 
Attached is an example which will show you the number of clicks on each of 2 buttons as well as the difference between the number or clicks.
 
It also disables button1 if the difference in clicks is greater than 5 - it will re-enable it when the difference drops to 5 (and stay enabled until it exceeds 5).
 
You should be able to use the ideas in this example to code your desired behavior.
 
Best Regards,
 
JLS

Message Edited by JLS on 03-14-2007 05:29 PM

Best,
JLS
Sixclear
0 Kudos
Message 7 of 7
(3,793 Views)