I just received my first Arduino (an Arduino Uno to be specific) in the mail yesterday and have been working on setting it up to look like a HID keyboard when it is plugged into the computer. I followed ant.b's topic to get started and expanded it to fit my needs. For specific steps in the process of making the Arduino appear to be an HID device, please see his post: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285962838.

When I first came up with the idea for this project, I tried to find someone who had already done what I wanted to do. I wanted to build off of someone's experiences with turning an Arduino into a keyboard but the only information I could find that was even remotely helpful was ant.b's post. I hope that someone out there finds what I have done useful for their purposes.

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.*/

/*When we send data to the keyboard driver, it has to bescancodes, not ascii characters. Refer to the AVR keyboardsource code to obtain the scancodes. Notes: -Modifiers (Shift, Alt, Ctrl) only modify the next character. -When sending modifiers, the byte that is sent must be the amount of shift (referenced in the source code) plus 0xf0. -Only one modifier can be used at a time. -Once a modifier is sent, it will remain on until one of two things happen: another byte is sent, or the same modifier is pressed on another keyboard connected to the system. -A delay of at least 25 milliseconds is required after each byte in order to gice the keyboard driver time to respond. A function to take care of this might be needed.*/

If you load the sketch up and then reflash the 8u2 with the keyboard.hex file, it will begin typing 6 seconds after being reset. With that being said, be sure to have notepad or something in focus on your computer so that you don't accidentally screw up a sketch.

Please keep in mind that LUFA and ant.b's code and contributions are copyright their respective owners.

Arduino This is being sent FROM THE Arduino This is being sent FROM THE Arduino This is being sent FROM THE Arduino This is being sent FROM THE Arduino This is being sent FROM THE Arduino This is being sent FROM THE Arduino This is being sent FROM THE Arduino

Hi, I have a little problem with that. The keyboard works fine, but only in program like notepad, word, or text input box in internet browser, but if I want it to work for egz in movie player (like a shortcut- i press spacebar, and movie start, pause) or in winamp, the pc just dont see my virtual arduino keyboard and nothing happend. Anyone has an idea? or mayby can you test this keyboard in many aplications too ? thx

@ayen:I was unable to reproduce the problem you're having. I tested the functionality in Winamp, Windows Media Player, and VLC. It works using the sketch below and with the Arduino Keyboard HEX file (in the zip file) reference in my first post.

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.*//*When we send data to the keyboard driver, it has to bescancodes, not ascii characters. Refer to the AVR keyboardsource code to obtain the scancodes. Notes: -Modifiers (Shift, Alt, Ctrl) only modify the next character. -When sending modifiers, the byte that is sent must be the amount of shift (referenced in the source code) plus 0xf0. -Only one modifier can be used at a time. -Once a modifier is sent, it will remain on until one of two things happen: another byte is sent, or the same modifier is pressed on another keyboard connected to the system. -A delay of at least 25 milliseconds is required after each byte in order to gice the keyboard driver time to respond. A function to take care of this might be needed.*/

void sendSCString(String stringToSend) // send a string of characters with no carriage return{ // for everyn character in the string, convert to scancode and send for ( int i = 0; i < stringToSend.length(); i++) { sendSCByte(convertAsciiToScanCode(stringToSend.charAt(i))); }}

void sendSCStringLine(String stringToSend) // send a string of chars with a carriage return at the end{ // concatenate a carraige return onto the end of the string and then send like a normal string stringToSend.concat(byte(0x0d)); sendSCString(stringToSend);}

ok. very sorry, everything is now working fine. at first i used only a few line of your code, and the rest was my solution. If i copy all your code, virtual keyboard works perfect. My bad. respect for your job