LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keyboard Characters

Hi all. I was wondering if there is a different method of using keyboard characters to initialise an action. Currently I'm using "w,a,s,d,i,j,k,l" in events structure to control Throttle, Pitch, Roll and Yaw. Can I not use events structure to use the keyboard characters? Please advice.

 

Thank you

Khairil

0 Kudos
Message 1 of 6
(2,364 Views)

Khairil,

 

your question puzzles me as your code already seems to contain your answer in the "Key Repeat" event case.

I assume that you want to use the same code in the "Key Up" event.

 

You can, in order to prevent duplicated code, add the event source "Key Up" to the same event case as "Key Repeat" (press the "+" button in the edit event case dialog)

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 6
(2,359 Views)

I'm sorry if I wasn't clear. What I meant was I want to replace the events structure if possible. Is it possible?

 

Thank you

Khairil

0 Kudos
Message 3 of 6
(2,356 Views)

Khairil,

 

you could use the Input Device Control palette functions for this. BUT: why do you want to get away from event based programming to a polling system? Is it because of the VISA connection?

If the second point is true, you should instead either define a time out of your polling time in the event structure (hence getting a polling loop) or split it up to something like an adopted producer/consumer architecture.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 6
(2,338 Views)

The reason is I'm using the key repeat event. However when it executes, it is not immediate due to the nature of key repeat if I'm not wrong. Someone suggested I added a key down event so that it will "skip" so that there would not be much of a "lag". It works on my VI but it does not work on the NAZA M Assistant software that I'm using. I have been unable to find a way to reduce the 'lag' time. Please advice.

 

Thank you

Khairil

0 Kudos
Message 5 of 6
(2,283 Views)

Khairil,

 

you are correct that Key Repeat has a delay as the initial key press is not triggering the event. Only if the key is pressed for some time, the event Key Repeat is created.

So Key Down is a good candidate to address the "lag"; you have to add this as event source to the same event case as Key Repeat, as both events should trigger the same code.

Your current code contains a separate event case for Key Up (not Key Down!) and this case is empty. So essentially, you are "triggering" to the wrong situation AND if that situation occurs, you do NOTHING.

 

I am confident that (if your system is not loaded by parallel running applications) if you correct the two things (or, as i recommend, simply add Key Down as source for the existing Key Repeat case!) you will not see such a delay as it is right now.

On the other hand: I do not know how long it takes that the first Key Repeat event is created, as well as how long it takes "to repeat". It is possible, that the initial delay is longer (e.g. 1s) than the "repeat frequency" (e.g. 0.5s). So it is still possible that the user sees a little "jerk" at the start.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 6
(2,264 Views)