The Arduino part is pretty straight forward. It sends structured messages to the receiver on the PC, which are structured like this:
sk [command] [key_code]
A command can be either, press, release or tap (press and release), the key_code is something Microsoft provides us with here. The receiver takes the key_code and tells the oprating system what do with it according to the command received from the Arduino.
Which means you can do stuff like, hold Shift, tap 1, release Shift. Which will in return get you an ! on the PC.
The Arduino code for such a task will looks like this:
#include <SoftKeyboard.h>
SoftKeyboard sk;
void setup() {
Serial.begin(9600); //Must init Serial in order for SoftKeyboard to work!
}
void loop() {
sk.press(0x10); //hold Shift down
sk.tap(0x31); //tap '1' (with shift makes it '!')
sk.release(0x10); //release Shift
delay(1000);
}
The receiver was implemented with C#, using some un-managed code of course (other wise you can not get full advantage of Windows' keyboard APIs).
Notes:
You can't see the serial port traffic form the Arduino IDE and be connected to the SoftKeyboard receiver at the same time, so the receiver has a -v option, to let you see what the Arduino is sending.
Ok, that was enough blah-blah, you can find the code and the receiver .exe here: https://github.com/MeLight/soft-keyboard
Let me know if you have questions or suggestions (you can do to that in the repo too of course)
could you provide c# code that u have written Thanks :)
ReplyDeleteFor a such a project
Ok, added the Program.cs file to the repo
DeleteHey could you make a 32bit version too? The one downloadable is only 64bit :(
ReplyDeleteAlready thanks alot man! You make my Duemilanove feel young again :p
Hi man, thanks for using it. I'm afraid I don't have access to a 32 bit machine at the moment. But you can take the Program.cs file and compile it in Visual Studio Express, it will provide you with 32bit version of the .exe if you do it on a 32bit machine
DeleteThanks, thats useful
ReplyDeleteHi.
ReplyDeleteThank you for sharing this information. about Software only Arduino keyboard emulator this information was so useful to us.
Here is sharing some Oracle Project Accounting information may be its helpful to you.
Oracle Project Accounting Training
Hi.
ReplyDeleteThan you for sharing this information it was good and this blog was giving good information.
and Here is sharing some Salesforce Service Cloud information that may be helpful to you.
Salesforce Service Cloud Training