Go Down

Topic: Arduino working as a keyboard (Read 561 times) previous topic - next topic


I am really a noob in this topic and this is my first project. So if you could spare some time please help me.

I want to use my arduino uno as a response logging tool. The setup should contain two buttons, the state of the buttons should be monitored, when button 1 is pressed the arduino should act as HID keyboard and send an "a". If Button two is pressed a "d" should be send.

What I found:
I found already some piece of code http://arduino.cc/forum/index.php?topic=99.0 Theire is said "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." If I could load that code and adjust it, it would help me very much. But I donĀ“t know how to that. I downloaded the WinAVR but I don`t know how to use it propperly.

My Questions:
How can I get the arduino to work like a HDI
Which pins can I use to Monitor the state of the buttons and which  circuit do I need to work propperly.

Sry to bother you I really tried to find someting by myself.


Hey i think i'm trying to do somethign just like you. But what your trying to do. So you hit the button, the arduino sends serially, an A into the computer. Then if the other button is pressed it'll do a D instead.

If thats what your trying. It wouldn't be too hard to makeup a sketch on the arduino to send in one of those 2 letters when a button is pressed. Just a digital button tutorial doubled with a serial.print

as for the comptuer side of things. a couple of older useres of this froum told me to look up "gobetwino".
Its a nifty program that will let you do stuff based on a serial signal in.
Heres the website. http://mikmo.dk/gobetwino.html
I'm still messing with getting it to work though, havent gotten to play with it yet. But it might be just what you need.


if you want it to act as a real HID usb keyboard, you don't need gobetwino at all. just use this lib to make it act as a real keyboard.

the schematics and code are all present at that page, so it won't be that hard, you need pin2, 4 and 5.
i already did one myself and it works perfect...


The playground is a great place to find info like this. Try http://arduino.cc/playground/Main/InterfacingWithHardware#USB for examples of running your UNO or Atmega2560 as a keyboard HID device.


May 18, 2012, 12:15 pm Last Edit: May 21, 2012, 12:47 pm by fkriegel Reason: 1
next question. Since the software which is running in the background frequently asks for the device state and getting a device state over the usb takes very long i would like to use the RS232 Port (found a shield http://www.cutedigi.com/arduino-shields/rs232-shield-for-arduino.html)for the keyboard emulation. Is this possible or do I have to change anything ?

Thanks in advance

# Push


Hi I discovered a new problem. I can not get the Arduino 0016 Version to run and the Libary mentioned in the Book works only with the old 0016 Version. Has someone any advice ?

System: Windows 7 64 Bit

Go Up