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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simultaneous keyboard switch to boolean

Solved!
Go to solution

Hi all,

 

I'm trying to create a safety sequence where two keyboard buttons have to be pressed simultaneously and held for a set time before a true condition is set for a process to occur.

I've attached a vi with my trial. Currently, only one button press registers(only one indicator lights up) instead of both keys. I've tried using two seperate loops (one for each key) but that resulted with the same results. I've inserted a 3 second wait before the loop to give time for the user to press the  z and / keys.

 Any suggestions would be greatly appreciated!

 

Thanks,

 

Chris

 

 

Labview version is 8.6

0 Kudos
Message 1 of 4
(2,127 Views)

If you want both buttons pressed at the same time, you shouldn't be indexing out the first key.  Instead, use the Search 1D Array to see if a z was pressed.  Do the same for the /.  If both of them are found (index >=0) increment a counter.  If one of them was not found (index < 0), reset the counter to 0.  Set a loop rate to something like 50ms.  So if your count gets to high (3 seconds/50ms/loop = 60 loops), you can exit and do your sequence.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(2,123 Views)
Solution
Accepted by topic author ck_tigers
Message 3 of 4
(2,117 Views)

Thank you both!

 

0 Kudos
Message 4 of 4
(2,100 Views)