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: 

Detecting Key Release when using "Acquire Input Data.vi"

Solved!
Go to solution

Hi Everyone,

 

I'm trying to write code to be able to continuously scan for keyboard input while my LabVIEW program runs in the background, I want to be able to tell when the return key has been pressed and released.

 

I've found that using "initialize keyboard.vi" and "acquire input data.vi" is working well for reading the keyboard in the background.

However as far as I can tell there isn't a unique output from Acquire Input Data.vi for when there is no key pressed which I'd like to be able to use to detect the key release.

 

I have also messed about with the event structure for detecting keyboard input to some success but wasn't able to get that to run with my LabVIEW program in the background.

 

Any help is much appreciated.

0 Kudos
Message 1 of 3
(630 Views)

Handle Keyboard Events in Event Structures in LabVIEW

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 3
(578 Views)
Solution
Accepted by topic author tommyK

You can keep the value from the previous iteration of the loop and check for the case where the key was pressed in the last iteration and is not pressed in the current iteration. I would suggest passing the actual is return pressed boolean as the state and then you can simple use a Compound Arithmetic node.

 

There are multiple mechanisms to do this, but I would suggested a feedback node as the one which is clean and requires a minimum amount of code.


___________________
Try to take over the world!
0 Kudos
Message 3 of 3
(551 Views)