LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview example monitor keyboard VI not working

Hi all,

 

This is my first post and I am still learning how to use Labview. For my project I wanted to control the DaNI robot with keyboard inputs. I started off searching for example codes and help on forums. 

I found the "Monitoring keyboard and Mouse Activity.vi" from available examples in Labview. When I run the VI, the horizontal and vertical mouse positions are recorded but not the keys pressed. On my front panel the "Keys Pressed" array is greyed out and all the values stay at 0 no matter which keys i press (letters, numbers, function keys, number pad etc). I have tried similar VIs from forum posts but I always encounter the same probleme. They keyboard keys don't seem to be registered by Labview.

 

I attached the example VI in case.

 

Thanks for any Help!

0 Kudos
Message 1 of 4
(3,461 Views)

It works for me. It is a polling functionality, so it will miss your key presses if they don't last long enough for an iteration to grab them.

At least we know your keyboard works because you were able to type this out. Smiley Wink

Try holding down a key?

 

If you want to just control the robot when you have the LabVIEW window active, I would suggest you use the LabVIEW event structure functionality. You can trigger an event when the user presses keys and don't have to poll like above. It's much more efficient. 

Here's a helpful example.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 4
(3,456 Views)

Thanks for your reply. I tried holding the keys down but unfortunately it didn't solve my issue. When I run the VI, the keyboard keys I press aren't registered. I tested and followed the example VI you linked but the same issue happens. I'm working from a university computer but will try on my personal one to see if this changes anything.

 

I have a rough idea of how to control the robot using event structures for each key. But I can't test the code until I can get Labview to recognise the keyboard inputs.

0 Kudos
Message 3 of 4
(3,379 Views)

@MortZ wrote:

I tested and followed the example VI you linked but the same issue happens. I'm working from a university computer but will try on my personal one to see if this changes anything.


That's strange... Is the event trigger the only thing not working? Are you able to type in a string control?

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 4
(3,339 Views)