How to output keystrokes to my computer
Does anyone know how to output keystroke characters to my desktop computer with a BS2?· For example, when· I press a button on my BS2 project board, I would like to see a character show up on Notepad or Wordpad (or any other program for that matter).·· I have a USB2SER adapter on my BS2.··
I am building a flight simulator, and MS Flight Simulator will allow for keypress assignments within the program.· I would like to avoid adding extra cabling to my BS2 project board, like a PS2.· The idea solution would output the text through the USB cable that is all ready connected to the computer.·· Can this program code reside completely in the BS2, and not have to run external software loaded my desktop computer?
Thanks for your help.
I am building a flight simulator, and MS Flight Simulator will allow for keypress assignments within the program.· I would like to avoid adding extra cabling to my BS2 project board, like a PS2.· The idea solution would output the text through the USB cable that is all ready connected to the computer.·· Can this program code reside completely in the BS2, and not have to run external software loaded my desktop computer?
Thanks for your help.
Comments
SlashWeep's method is the only way you are going to get it to work with just the USB. In C# and VB.NET, you have a function called "Sendkeys" that will take whatever key you feed it and send it to the open application. I don't think there's too much danger of missing the key press as long as the C# program is listening for the character in a loop. It would look something like this (pseudocode):
serial_port = Serial.open("com3"); // or com1, or 2, or 4...
while (running)
{
key_pressed = serial_port.receive();
SendKeys(key_pressed);
}
Have a great day!
·
I attached it to this thread a long while back .. Should do the trick
http://forums.parallax.com/showthread.php?p=627711
it is listed as Par_kb.zip
I have attached a link to it here also..
http://forums.parallax.com/attachment.php?attachmentid=45863
John Twomey
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
Thanks for the code and your suggestions.· I have not had a chance to try out the program yet, but I'll let you know if I have problems.