11-18-2010 02:55 AM
Hi
This is extreamely simple example of reading the keyboard in a different way. Maybe this idea could be used in Your application.
Hope it helps.
Barbara_XYZ
11-21-2010 02:34 PM
Hi Barbara, you have been very helpfull 🙂
i have used the method from your last VI, and thanks to that i can identify
2 buttons pressed ( the sum of two numbers goes to case and then a differnt char is send, there is only one
example in this VI - when i press A+W it sends 'q' char over serial port ). It has been tested on com0com virtual ports.
Still got the problem with the up event..... this methods seems not to work so good for this event..... I want to send the
motors termination char 'z' when i release the button , and when i have two buttons pressed i DON'T want to send a termination
char after releasing one of them, after releasing one of them it would be nice also to send the one which hasn't been released.
Any ideas ?
thanks
11-25-2010 05:20 AM
Sorry, I haven't answeared before, but I had a training and did not have time.
I think that the best solution would be to change this architecture to producent - consumer structure. In one loop entire user interface would be applied and would send a que to a customer loop with action information. The second loop would make a control. I'll make an example this weak and I'll send it to You.
Best regards
Barbara
11-26-2010 01:43 AM
Hi
Analyze this example. It shows different way of solving the issue - I think it should work in the way You want, plus it is easy to reconfigure it according to requirements.
Let me know if it helps.
Your faithfully
Barbara
11-26-2010 02:19 PM
Hi Barbara,
thanks for the effort 🙂
it took me a while to understand the code.... it makes me dizzy to see
all the stuff in there....
i put in there the chars to send over a serial port.... and have tested it with the robot. It works fine, but it sends
chars continously, so the robot receives chars continously ( a microprocessor on the robot won't be especially able to do other stuff ). It would be fine
if it wasn't supposed to do other stuff . Any more ideas ?:P Sorry for the trouble... 🙂
best regards
pauldab
11-29-2010 01:34 AM
Hi
Go to function palet - programming - timing. There are few very usefull timing functions available. Check their properties in help. Those will easily solve the problem. I recommend Wait Until Next ms Multiple - place it in the loops, it will define duration of a single interaction. If iteraction is executed in less time, then it is specified by this function - program will wait and this time can be used by a processor for any other actions.
In case of trouble - let me know.
Best regards
Barbara
11-29-2010 02:21 PM
Hi,
that's what i fought , and it will have to do. I'm also going to steer the robot with a Joystick, that
gives values from -32768 to 32767 in X , Y axis. First i was trying to do that in poor way.. just to connect directly conditions to the led,
and then i realized that i would be more efficent to put it into Case structure ? Is it even possible ? I don't know how to make the case like for example : input<=32767&&input >=25234. Is it possible to put this in the case structure? One case structure would be for X and the other inside the first one would be for Y. Don't look and the values on led's labels - it's all messed up.I'm attaching the example
Thanks for help Barbara 🙂
11-30-2010 04:23 AM
Hi
I do not fallow Your code to be honest to well.
As for a case, sure it could be done. All You have to do is to make a case selection by mean of programming\comparision\select function from function pallet. You set up two cases - for X and Y axis. Make a condition by mean of bigger/smaller/equal etc. functions and it should work just fine. Define the boolean values as in the previous example.
Let me know, if it helps
Good luck
Barbara
11-30-2010 12:03 PM
Hi
the idea of the code was to make a visualisation of the current position of Joystick with LED's.
Form the joystick i have got a the values of X and Y position. With the "In Range and Coerce" i could set
the UPPER anf LOWER limit for X and Y. And the boolean value "In Range?" from X and Y goes to logical AND ( so
the LED is on when the upper and lower for X and other for Y are met at the same time - position of the joy ). It's everything in
main while loop so it's all messy. I would like to put it in the case selector and not direclty turning LED's on but with Barbara your method of property node – value ( put in a case selector ). Simply don't know how to put this condition in the case selector. I'm attaching the jpg.
So Barbara i can't put the condition in case itself... it should be done with your method outside case ? ( wasn't even able to od it 😞 ) :d . What do you think about this "In Range and Coerce" method ?
cheers
pauldab
11-30-2010 12:48 PM - edited 11-30-2010 12:52 PM
Hi, here is a VI that demonstrates how to capture key up/down events. It captures events on the VI's front panel, this can be changed to any control on a front panel (FP), but then it requires the focus to be on that control, I just did it on the FP for demonstration purposes. Notice that multiple keys can be pressed and it will recognize when they are released.
There are a few things I didn't handle, like modifiers (ctrl, alt, shift) and possibly other keys, nor did I close the open refnum to the VI which probably should be done. But again, this is an example.
I hope this helps you. Sounds like a fun project. 😄
A